Opened 4 years ago

Last modified 4 years ago

#3064 new defect

Audio drafting out of sync on Samsung TV with ffmpeg created MP4 or MKV file

Reported by: ramitbhalla Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: When I create a MP4 file with AAC Audio or MKV with AC3 Audio the final file, the audio slowly over time drifts out of sync with the video when playing back on a Samsung TV.

This is wierd for 2 reasons:

  1. This ONLY happens with ffmpeg created MP4 and MKV files. I create the same file with Handbrake it plays back fine with the Samsung TV
  2. The file plays fine on other players (WMP, MCE, KMPlayer etc).

Not sure what it is about ffmpeg created MP4 and MKV files that cause the audio to drift out. Is there some tag or setting I need to enable to make it more compliant universally? What is Handbrake doing to make it play fine. Not sure how to report this.

This it the command I'm using to create the file.

ffmpeg -probesize 100M -analyzeduration 300M -threads 0 -y -i "How I Met Your Mother_WGCL_2013_10_14_19_59_00.ts" -ss 3 -vf yadif=0:-1,hqdn3d,crop=704:384:8:34 -vcodec libx264 -b 1916444 -x264opts me=hex:trellis=1:subq=8:partitions=all:8x8dct=1:ref=3:rc-lookahead=50:keyint=25:min-keyint=20:bframes=1:weightb=1:level=4.0:b-pyramid=normal:direct=auto:mixed-refs=1:deblock=-1,-1:no-fast-pskip=1:no-dct-decimate=1:b-adapt=0:threads=auto -map 0:a -map 0:v -acodec libfdk_aac -ab 160k -cutoff 18000 -af volume=3.9dB -ac 2 "How I Met Your Mother_WGCL_2013_10_14_19_59_00-converted.mp4"


ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 14 2013 09:33:16 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++ --enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disable-shared --enable-libsoxr --enable-fontconfig --enable-libass   libavutil      52. 40.100 / 52. 40.100

Change History (27)

comment:1 Changed 4 years ago by cehoyos

(Could you point us to your report to Samsung about this problem?)

Is this only reproducible using an external library or also with an internal encoder (mpeg4)?
Is a filter chain necessary to reproduce the problem?
Please add the complete, uncut console output to make this a valid ticket but please use a minimal command line.

comment:2 Changed 4 years ago by ramitbhalla

I haven't reported to Samsung yet, possibly they won't do anything but I'll report it anyways.

The TV model is UN46C6300SFXZA

I'll try mpeg4, so far using libx264. I'll try without the filter chain and post the output also.

comment:3 Changed 4 years ago by ramitbhalla

Okay so there are the results, I tried 2 additional configurations:

  1. With only libx264, no filter chains
  2. With mpeg4, no filter chains

With both it created a mp4 file in which the audio slowly drifts out of sync when played back on the TV.

I also tried using handbrake on the same file and it doesn't drift when playing back on the TV.

This is happening with ALL the files, not just one.

ffmpeg.2314Custom1.exe -y -i "..\House.wtv" -vcodec mpeg4 -b 1368888 -map 0:a -map
0:v -acodec libfdk_aac -ab 160k -cutoff 18000 -ac 2 test.mp4
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 14 2013 09:33:16 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r
 --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disab
le-shared --enable-libsoxr --enable-fontconfig --enable-libass   libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[wtv @ 03b24640] truncated file
    Last message repeated 2 times
[mpeg2video @ 03b15360] Invalid frame dimensions 0x0.
    Last message repeated 13 times
Input #0, wtv, from '..\House.wtv':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : House
    WM/SubTitle     : Fetal Position
    WM/SubTitleDescription: A pregnant photographer collapses in the midst of a photo shoot with a famous musician (Tyso
n Ritter); Foreman and Cuddy learn about Cameron and Chase's secret relationship.
    genre           : Drama;General;Series
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : Hugh Laurie/Lisa Edelstein/Omar Epps/Robert Sean Leonard/Jennifer Morrison/Jesse Spencer;;;Anne Ra
msay/Tyson Ritter/Jeff Sugarman/Bobbin Bergstrom
    service_provider: USA
    service_name    : USA Network
    WM/MediaNetworkAffiliation: Satellite
    WM/MediaOriginalChannel: 42
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2007-04-03T04:00:00Z
    WM/MediaOriginalRunTime: 12784870062
    WM/MediaIsStereo: true
    WM/MediaIsRepeat: true
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: false
    WM/MediaIsMovie : false
    WM/MediaIsPremiere: false
    WM/MediaIsFinale: false
    WM/MediaIsSAP   : false
    WM/MediaIsSport : false
    WM/ParentalRating: TV-14
    WM/Provider     : MediaCenterDefault
    WM/VideoClosedCaptioning: true
    WM/WMRVEncodeTime: 2012-02-01 18:40:41
    WM/WMRVSeriesUID: !MCSeries!00688359
    WM/WMRVServiceID: !MCService!28459373
    WM/WMRVProgramID: !MCProgram!165184208
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 3
    WM/WMRVOriginalSoftPrePadding: 2498
    WM/WMRVOriginalSoftPostPadding: 120
    WM/WMRVHardPrePadding: -2438
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: false
    WM/WMRVHDContent: false
    Duration        : 12344800341
    WM/WMRVEndTime  : 2012-02-01 19:01:15
    WM/WMRVBitrate  : 8.074463
    WM/WMRVKeepUntil: 0
    WM/WMRVActualSoftPrePadding: -3
    WM/WMRVActualSoftPostPadding: 75
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
  Duration: 00:20:13.31, start: 11.593745, bitrate: 8215 kb/s
    Stream #0:0[0x32]: Subtitle: eia_608
    Stream #0:1[0x33]: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97 tbr, 10000k tbn, 5
9.94 tbc
    Stream #0:2[0x34]: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p, 256 kb/s
Please use -b:a or -b:v, -b is ambiguous
Output #0, mp4, to 'test.mp4':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : House
    WM/SubTitle     : Fetal Position
    WM/SubTitleDescription: A pregnant photographer collapses in the midst of a photo shoot with a famous musician (Tyso
n Ritter); Foreman and Cuddy learn about Cameron and Chase's secret relationship.
    genre           : Drama;General;Series
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : Hugh Laurie/Lisa Edelstein/Omar Epps/Robert Sean Leonard/Jennifer Morrison/Jesse Spencer;;;Anne Ra
msay/Tyson Ritter/Jeff Sugarman/Bobbin Bergstrom
    service_provider: USA
    service_name    : USA Network
    WM/MediaNetworkAffiliation: Satellite
    WM/MediaOriginalChannel: 42
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2007-04-03T04:00:00Z
    WM/MediaOriginalRunTime: 12784870062
    WM/MediaIsStereo: true
    WM/MediaIsRepeat: true
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: false
    WM/MediaIsMovie : false
    WM/MediaIsPremiere: false
    WM/MediaIsFinale: false
    WM/MediaIsSAP   : false
    WM/MediaIsSport : false
    WM/ParentalRating: TV-14
    WM/Provider     : MediaCenterDefault
    WM/VideoClosedCaptioning: true
    WM/WMRVEncodeTime: 2012-02-01 18:40:41
    WM/WMRVSeriesUID: !MCSeries!00688359
    WM/WMRVServiceID: !MCService!28459373
    WM/WMRVProgramID: !MCProgram!165184208
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 3
    WM/WMRVOriginalSoftPrePadding: 2498
    WM/WMRVOriginalSoftPostPadding: 120
    WM/WMRVHardPrePadding: -2438
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: false
    WM/WMRVHDContent: false
    Duration        : 12344800341
    WM/WMRVEndTime  : 2012-02-01 19:01:15
    WM/WMRVBitrate  : 8.074463
    WM/WMRVKeepUntil: 0
    WM/WMRVActualSoftPrePadding: -3
    WM/WMRVActualSoftPostPadding: 75
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    encoder         : Lavf55.12.102
    Stream #0:0: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 160 kb/s
    Stream #0:1: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=2-31, 1368 kb/s, 30k tbn, 29.
97 tbc
Stream mapping:
  Stream #0:2 -> #0:0 (mp2 -> libfdk_aac)
  Stream #0:1 -> #0:1 (mpeg2video -> mpeg4)
Press [q] to stop, [?] for help
ac-tex damaged at 19 17.2 size=  226259kB time=00:20:11.84 bitrate=1529.5kbits/s dup=30 drop=0
[mpeg2video @ 03b15360] Warning MVs not available
[mpeg2video @ 03b15360] concealing 585 DC, 585 AC, 585 MV errors in P frame
[mp2 @ 021fd0c0] incomplete frame
Error while decoding stream #0:2: Invalid data found when processing input
frame=36379 fps=186 q=6.3 Lsize=  227746kB time=00:20:13.84 bitrate=1537.0kbits/s dup=32 drop=0
video:203016kB audio:23696kB subtitle:0 global headers:0kB muxing overhead 0.455695%

comment:4 Changed 4 years ago by cehoyos

Please remove the -map options.
Is libfdk necessary to reproduce the problem or is it also reproducible with -acodec aac -strict -2 ?
Is the problem both reproducible with a high and a low constant quantiser?

comment:5 Changed 4 years ago by ramitbhalla

Yes to the above, even without the map options it still happens.
It also happnens with aac, initialy I thhought it was because of aac so I built a cusotm version of ffmpeg with libfdk thinking it may fix the issue.
It also happens with ac3, so it's not codec specific (happens with ac3, fdk, aac, mpeg4 and libx264).

by quantizer I suspect you mean qscale, I tried 1 and 20 and it happens with both. It doesn't drift much, a little like in 20 minutes it drifts by about 1-2 seconds.

Any ideas?

comment:6 Changed 4 years ago by cehoyos

Not really related: Why did you use yadif in your original command line? Isn't this a telecined input sample?

Please provide a command line without external libraries, then test with older FFmpeg and the same command line.

comment:7 follow-up: Changed 4 years ago by ramitbhalla

No particular reason I use a batch script/mcebuddy program to convert the files, just a template.

Here is the simplest command I can use to replicate the issue.

ffmpeg.239-2310 -i ..\House.wtv -vcodec mpeg4 -b 700k -acodec aac -strict -2 -ab 12
8k test.mp4
ffmpeg version N-46726-g2f74f8d Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 13 2012 19:29:51 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable
-bzlib --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enab
le-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroed
inger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-li
bvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52.  6.100 / 52.  6.100
  libavcodec     54. 71.100 / 54. 71.100
  libavformat    54. 36.100 / 54. 36.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.100 /  3. 23.100
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
[mpeg2video @ 02fd52c0] mpeg_decode_postinit() failure
    Last message repeated 13 times
Input #0, wtv, from '..\House.wtv':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : House
    WM/SubTitle     : Fetal Position
    WM/SubTitleDescription: A pregnant photographer collapses in the midst of a photo shoot with a famous musician (Tyso
n Ritter); Foreman and Cuddy learn about Cameron and Chase's secret relationship.
    genre           : Drama;General;Series
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : Hugh Laurie/Lisa Edelstein/Omar Epps/Robert Sean Leonard/Jennifer Morrison/Jesse Spencer;;;Anne Ra
msay/Tyson Ritter/Jeff Sugarman/Bobbin Bergstrom
    service_provider: USA
    service_name    : USA Network
    WM/MediaNetworkAffiliation: Satellite
    WM/MediaOriginalChannel: 42
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2007-04-03T04:00:00Z
    WM/MediaOriginalRunTime: 12784870062
    WM/MediaIsStereo: true
    WM/MediaIsRepeat: true
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: false
    WM/MediaIsMovie : false
    WM/MediaIsPremiere: false
    WM/MediaIsFinale: false
    WM/MediaIsSAP   : false
    WM/MediaIsSport : false
    WM/ParentalRating: TV-14
    WM/Provider     : MediaCenterDefault
    WM/VideoClosedCaptioning: true
    WM/WMRVEncodeTime: 2012-02-01 18:40:41
    WM/WMRVSeriesUID: !MCSeries!00688359
    WM/WMRVServiceID: !MCService!28459373
    WM/WMRVProgramID: !MCProgram!165184208
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 3
    WM/WMRVOriginalSoftPrePadding: 2498
    WM/WMRVOriginalSoftPostPadding: 120
    WM/WMRVHardPrePadding: -2438
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: false
    WM/WMRVHDContent: false
    Duration        : 12344800341
    WM/WMRVEndTime  : 2012-02-01 19:01:15
    WM/WMRVBitrate  : 8.074463
    WM/WMRVKeepUntil: 0
    WM/WMRVActualSoftPrePadding: -3
    WM/WMRVActualSoftPostPadding: 75
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
  Duration: 00:20:13.31, start: 11.593745, bitrate: 8215 kb/s
    Stream #0:0[0x32]: Subtitle: eia_608
    Stream #0:1[0x33]: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97 tbr, 10000k tbn, 5
9.94 tbc
    Stream #0:2[0x34]: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16, 384 kb/s
Please use -b:a or -b:v, -b is ambiguous
Output #0, mp4, to 'test.mp4':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
    Title           : House
    WM/SubTitle     : Fetal Position
    WM/SubTitleDescription: A pregnant photographer collapses in the midst of a photo shoot with a famous musician (Tyso
n Ritter); Foreman and Cuddy learn about Cameron and Chase's secret relationship.
    genre           : Drama;General;Series
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : Hugh Laurie/Lisa Edelstein/Omar Epps/Robert Sean Leonard/Jennifer Morrison/Jesse Spencer;;;Anne Ra
msay/Tyson Ritter/Jeff Sugarman/Bobbin Bergstrom
    service_provider: USA
    service_name    : USA Network
    WM/MediaNetworkAffiliation: Satellite
    WM/MediaOriginalChannel: 42
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2007-04-03T04:00:00Z
    WM/MediaOriginalRunTime: 12784870062
    WM/MediaIsStereo: true
    WM/MediaIsRepeat: true
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: false
    WM/MediaIsMovie : false
    WM/MediaIsPremiere: false
    WM/MediaIsFinale: false
    WM/MediaIsSAP   : false
    WM/MediaIsSport : false
    WM/ParentalRating: TV-14
    WM/Provider     : MediaCenterDefault
    WM/VideoClosedCaptioning: true
    WM/WMRVEncodeTime: 2012-02-01 18:40:41
    WM/WMRVSeriesUID: !MCSeries!00688359
    WM/WMRVServiceID: !MCService!28459373
    WM/WMRVProgramID: !MCProgram!165184208
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 3
    WM/WMRVOriginalSoftPrePadding: 2498
    WM/WMRVOriginalSoftPostPadding: 120
    WM/WMRVHardPrePadding: -2438
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: false
    WM/WMRVHDContent: false
    Duration        : 12344800341
    WM/WMRVEndTime  : 2012-02-01 19:01:15
    WM/WMRVBitrate  : 8.074463
    WM/WMRVKeepUntil: 0
    WM/WMRVActualSoftPrePadding: -3
    WM/WMRVActualSoftPostPadding: 75
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    encoder         : Lavf54.36.100
    Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=2-31, 700 kb/s, 30k tbn, 29.9
7 tbc
    Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (mpeg2video -> mpeg4)
  Stream #0:2 -> #0:1 (mp2 -> aac)
Press [q] to stop, [?] for help
ac-tex damaged at 19 172.9 size=  122373kB time=00:20:10.29 bitrate= 828.3kbits/s dup=30 drop=0
[mpeg2video @ 02fd52c0] Warning MVs not available
[mpeg2video @ 02fd52c0] concealing 585 DC, 585 AC, 585 MV errors in P frame
[mp2 @ 02fd58a0] incomplete frame
Error while decoding stream #0:2: Invalid data found when processing input
frame=36379 fps=143 q=15.5 Lsize=  123802kB time=00:20:13.84 bitrate= 835.5kbits/s dup=32 drop=0
video:103942kB audio:18827kB subtitle:0 global headers:0kB muxing overhead 0.841531%

comment:8 in reply to: ↑ 7 Changed 4 years ago by cehoyos

Replying to ramitbhalla:

No particular reason I use a batch script/mcebuddy program to convert the files, just a template.

But you do understand that yadif permanently damages your video if the input data was not interlaced?

Here is the simplest command I can use to replicate the issue.

ffmpeg.239-2310 -i ..\House.wtv -vcodec mpeg4 -b 700k -acodec aac -strict -2 -ab 128k test.mp4

Thank you, this looks much better, please test an old version now, perhaps 866009ea

comment:9 follow-up: Changed 4 years ago by ramitbhalla

Hmm I thought the point of -1 in yadif was to "auto" detect or should it be yadif 0:-1:1?

I'll download an older version and try it

comment:10 Changed 4 years ago by ramitbhalla

Can you give me the approximate build date for 866009ea since I cannot find it on the zeranoe website. I'll try to download the closest date to it.

comment:11 Changed 4 years ago by cehoyos

Did you already test the oldest binary available?

comment:12 Changed 4 years ago by ramitbhalla

no I didn't know around which date was the one your mentioned, the last one I tested was around Nov 2012. The oldest on zeranoe's site is May 2011. Do you want me to test that one?

comment:13 Changed 4 years ago by ramitbhalla

This is the oldest version I can find that doesn't crash while trying to encode it.
This one also exhibits the same issue.

ffmpeg -y -i ..\House.wtv  -vcodec mpeg4 -qscale 20 -acodec aac -strict -2 test.mp4

ffmpeg version N-31247-g5d4fd1d, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jul  4 2011 21:40:51 with gcc 4.6.1
  configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --en
able-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --
enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --
enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil    51. 11. 0 / 51. 11. 0
  libavcodec   53.  7. 0 / 53.  7. 0
  libavformat  53.  5. 0 / 53.  5. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 24. 3 /  2. 24. 3
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[mpeg2video @ 03508100] mpeg_decode_postinit() failure
    Last message repeated 13 times
Input #0, wtv, from '..\House.wtv':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74b
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000e
    Title           : House
    WM/SubTitle     : Fetal Position
    WM/SubTitleDescription: A pregnant photographer collapses in the midst of a photo shoot with a famous musician (Tyso
n Ritter); Foreman and Cuddy learn about Cameron and Chase's secret relationship.
    genre           : Drama;General;Series
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : Hugh Laurie/Lisa Edelstein/Omar Epps/Robert Sean Leonard/Jennifer Morrison/Jesse Spencer;;;Anne Ra
msay/Tyson Ritter/Jeff Sugarman/Bobbin Bergstrom
    service_provider: USA
    service_name    : USA Network
    WM/MediaNetworkAffiliation: Satellite
    WM/MediaOriginalChannel: 42
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2007-04-03T04:00:00Z
    WM/MediaOriginalRunTime: 12784870062
    WM/MediaIsStereo: true
    WM/MediaIsRepeat: true
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: false
    WM/MediaIsMovie : false
    WM/MediaIsPremiere: false
    WM/MediaIsFinale: false
    WM/MediaIsSAP   : false
    WM/MediaIsSport : false
    WM/ParentalRating: TV-14
    WM/Provider     : MediaCenterDefault
    WM/VideoClosedCaptioning: true
    WM/WMRVEncodeTime: 2012-02-01 18:40:41
    WM/WMRVSeriesUID: !MCSeries!00688359
    WM/WMRVServiceID: !MCService!28459373
    WM/WMRVProgramID: !MCProgram!165184208
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 3
    WM/WMRVOriginalSoftPrePadding: 2498
    WM/WMRVOriginalSoftPostPadding: 120
    WM/WMRVHardPrePadding: -2438
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: false
    WM/WMRVHDContent: false
    Duration        : 12344800341
    WM/WMRVEndTime  : 2012-02-01 19:01:15
    WM/WMRVBitrate  : 8.074463
    WM/WMRVKeepUntil: 0
    WM/WMRVActualSoftPrePadding: -3
    WM/WMRVActualSoftPostPadding: 75
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
  Duration: 00:20:13.31, start: 11.593745, bitrate: 8215 kb/s
    Stream #0.0[0x32]: Subtitle: [0][0][0][0] / 0x0000
    Stream #0.1[0x33]: Video: mpeg2video (Main), yuv420p, 720x480 [PAR 8:9 DAR 4:3], 9000 kb/s, 78.67 fps, 29.97 tbr, 10
000k tbn, 59.94 tbc
    Stream #0.2[0x34]: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
[buffer @ 034E5020] w:720 h:480 pixfmt:yuv420p tb:1/1000000 sar:8/9 sws_param:
Output #0, mp4, to 'test.mp4':
  Metadata:
    WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74b
    WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000e
    Title           : House
    WM/SubTitle     : Fetal Position
    WM/SubTitleDescription: A pregnant photographer collapses in the midst of a photo shoot with a famous musician (Tyso
n Ritter); Foreman and Cuddy learn about Cameron and Chase's secret relationship.
    genre           : Drama;General;Series
    WM/OriginalReleaseTime: 0
    WM/MediaCredits : Hugh Laurie/Lisa Edelstein/Omar Epps/Robert Sean Leonard/Jennifer Morrison/Jesse Spencer;;;Anne Ra
msay/Tyson Ritter/Jeff Sugarman/Bobbin Bergstrom
    service_provider: USA
    service_name    : USA Network
    WM/MediaNetworkAffiliation: Satellite
    WM/MediaOriginalChannel: 42
    WM/MediaOriginalChannelSubNumber: 0
    WM/MediaOriginalBroadcastDateTime: 2007-04-03T04:00:00Z
    WM/MediaOriginalRunTime: 12784870062
    WM/MediaIsStereo: true
    WM/MediaIsRepeat: true
    WM/MediaIsLive  : false
    WM/MediaIsTape  : false
    WM/MediaIsDelay : false
    WM/MediaIsSubtitled: false
    WM/MediaIsMovie : false
    WM/MediaIsPremiere: false
    WM/MediaIsFinale: false
    WM/MediaIsSAP   : false
    WM/MediaIsSport : false
    WM/ParentalRating: TV-14
    WM/Provider     : MediaCenterDefault
    WM/VideoClosedCaptioning: true
    WM/WMRVEncodeTime: 2012-02-01 18:40:41
    WM/WMRVSeriesUID: !MCSeries!00688359
    WM/WMRVServiceID: !MCService!28459373
    WM/WMRVProgramID: !MCProgram!165184208
    WM/WMRVRequestID: 0
    WM/WMRVScheduleItemID: 0
    WM/WMRVQuality  : 3
    WM/WMRVOriginalSoftPrePadding: 2498
    WM/WMRVOriginalSoftPostPadding: 120
    WM/WMRVHardPrePadding: -2438
    WM/WMRVHardPostPadding: 0
    WM/WMRVATSCContent: false
    WM/WMRVDTVContent: false
    WM/WMRVHDContent: false
    Duration        : 12344800341
    WM/WMRVEndTime  : 2012-02-01 19:01:15
    WM/WMRVBitrate  : 8.074463
    WM/WMRVKeepUntil: 0
    WM/WMRVActualSoftPrePadding: -3
    WM/WMRVActualSoftPostPadding: 75
    WM/WMRVContentProtected: false
    WM/WMRVContentProtectedPercent: 0
    WM/WMRVExpirationSpan: 9223372036854775807
    WM/WMRVInBandRatingSystem: 255
    WM/WMRVInBandRatingLevel: 255
    WM/WMRVInBandRatingAttributes: 0
    WM/WMRVWatched  : false
    encoder         : Lavf53.5.0
    Stream #0.0: Video: mpeg4, yuv420p, 720x480 [PAR 8:9 DAR 4:3], q=2-31, 200 kb/s, 30k tbn, 29.97 tbc
    Stream #0.1: Audio: aac, 48000 Hz, stereo, s16, 64 kb/s
Stream mapping:
  Stream #0.1 -> #0.0
  Stream #0.2 -> #0.1
Press [q] to stop, [?] for help
[mpeg2video @ 03508100] mpeg_decode_postinit() failure
Error while decoding stream #0.1
Error while decoding stream #0.1s
Error while decoding stream #0.1s
Error while decoding stream #0.1s
Error while decoding stream #0.1s
Error while decoding stream #0.1s
Error while decoding stream #0.1s
Error while decoding stream #0.1s
Error while decoding stream #0.1s
Error while decoding stream #0.1s
Error while decoding stream #0.1es
Error while decoding stream #0.1es
Error while decoding stream #0.1es
Error while decoding stream #0.1es
    Last message repeated 13 times 65702kB time=00:20:12.88 bitrate= 443.8kbits/s dup=29 drop=0
[mpeg2video @ 03508100] ac-tex damaged at 19 17
[mpeg2video @ 03508100] Warning MVs not available
[mpeg2video @ 03508100] concealing 585 DC, 585 AC, 585 MV errors
[mp2 @ 03509C00] incomplete frame
Error while decoding stream #0.2
frame=36378 fps=139 q=20.0 Lsize=   66504kB time=00:20:13.20 bitrate= 449.1kbits/s dup=31 drop=0
video:56262kB audio:9500kB global headers:0kB muxing overhead 1.128022%

comment:14 Changed 4 years ago by cehoyos

Is the problem only reproducible with wtv input or with any media file?

comment:15 Changed 4 years ago by ramitbhalla

I have tried wtv and ts files as sources files and both are exhibiting this issue. Will try another file

comment:16 follow-up: Changed 4 years ago by ramitbhalla

Interestingly, when I used a MP4 file as the source and reconverted it back to MP4 I didn't see this problem.
You're onto something here, when the source is WTV, ie directly use WTV or WTV stream copy remuxed to TS and then using that as the source it exhibits this issue.

comment:17 in reply to: ↑ 16 Changed 4 years ago by cehoyos

Replying to ramitbhalla:

directly use WTV or

WTV stream copy remuxed to TS and then using that as the source it exhibits this issue.

This makes no sense imo, you know as good as I do that remuxing wtv to mpegts doesn't work well.
Please test with a dvb dump or a bluray file or if cannot access those a transport stream encoded by FFmpeg.

comment:18 in reply to: ↑ 9 Changed 4 years ago by cehoyos

Replying to ramitbhalla:

Hmm I thought the point of -1 in yadif was to "auto" detect

It auto-detects if the source if bottom-field-first or top-field-first and afaict this is also what the documentation says.

or should it be yadif 0:-1:1?

This cannot work: All DVB streams here mark everything as interlaced, including 24/25fps (progressive) source material sent in 25i (50 fields per second).

Do you have any reason to assume your input file is not telecined?

comment:19 follow-up: Changed 4 years ago by ramitbhalla

This problem is only happening when using WTV as a source. what I'm confused is that ffmpeg is converting (from scratch if I'm right) mpeg2 to mpeg4, it's creating a whole new file, no copying/remuxing etc. What about the file being created is dependent upon the source of the video/container (in this case WTV)? Why is a mp4 file created from a wtv source different from a wtv file created from any other source?

Regarding the yadif filter, I see your point. I don't know of any way to "detect" whether the source is interlaced or not. I understand the idet filter is not reliable and only ends up adding overhead to the processing time (correct me if I'm wrong here), so just as a safety I apply the yadif filter to all source files (since applying to a progressive video looks better than not applying to a interlaced video). Any ideas on what I can do detect if the source is interlaced?

comment:20 in reply to: ↑ 19 Changed 4 years ago by cehoyos

Replying to ramitbhalla:

I understand the idet filter is not reliable

Please provide a sample, to the best of my knowledge the filter is very reliable (and no bug report is open).

comment:21 Changed 4 years ago by ramitbhalla

Haven't tried it, just googling on the internet and some reports were about it not working well. (https://lists.ffmpeg.org/pipermail/ffmpeg-user/2012-May/006417.html)

I'll take your word for it and try it out:

So technically the way to use idet and yadif would be:

-vf idet,yadif=0:-1:1

or would

-vf idet

suffice? (can't make out from the documentation whether yadif should be used in conjunction with idet or not)

comment:22 Changed 4 years ago by cehoyos

The idet filter is not meant to decide for a single frame if it should be deinterlaced or not, it allows you to (automatically) decide if a stream is interlaced and a deinterlacer should be used (in a subsequent ffmpeg call).
If you have a sample for which the idet filter does not work well, please provide it.

comment:23 follow-up: Changed 4 years ago by ramitbhalla

:)) what do you make of this? (sorry don't mean to be disrespectful but am just very confused here)

ffmpeg -y -i "..\0 Channel Audio - after Remuxing - The Adventures
of Abney and Teal_CBeebies_2013_01_03_17_55_00.wtv" -vf idet -an -sn -t 160 -f rawvideo NULL
[Parsed_idet_0 @ 03ab0aa0] Single frame detection: TFF:1367 BFF:2 Progressive:1227 Undetermined:1378
[Parsed_idet_0 @ 03ab0aa0] Multi frame detection: TFF:1643 BFF:0 Progressive:2331 Undetermined:0

Here is another file output:

[Parsed_idet_0 @ 03ab0aa0] Single frame detection: TFF:904 BFF:0 Progressive:447 Undetermined:514
[Parsed_idet_0 @ 03ab0aa0] Multi frame detection: TFF:930 BFF:0 Progressive:935 Undetermined:0

Interlaced or Progressive? Am I even doing this right?

comment:24 in reply to: ↑ 23 Changed 4 years ago by cehoyos

Replying to ramitbhalla:

Interlaced or Progressive?

Consider reading comment:6 again...

comment:25 follow-up: Changed 4 years ago by ramitbhalla

I see you point, but am still confused as to how idet or ffmpeg can tell me whether the input is telecine or interlaced or progressive?
any suggestions please? if TFF + BFF = Progressive, does that mean it's telecined?

comment:26 in reply to: ↑ 25 Changed 4 years ago by cehoyos

Replying to ramitbhalla:

I see you point, but am still confused as to how idet or ffmpeg can tell me whether the input is telecine

It cannot (directly) because this wasn't implemented, see ticket #3073.

or interlaced or progressive?

But if it reports both (many) interlaced and (many) progressive frames with numbers of the same magnitude the only explanations (imo) are that either the stream changed from interlaced to progressive or progressive to interlaced half way through (this is very common for long 25fps recordings where I live due to live content vs commercials) or that the stream is telecined.

Note that my original comment was not meant to suggest using idet, I just wanted to make sure that you know that yadif should only be used on interlaced content (because it damages all other content permanently).
And I wanted to know why you believe idet is unreliable (when all other methods except visual inspection are known to simply not work, see http://thread.gmane.org/gmane.comp.video.ffmpeg.user/42613).

comment:27 Changed 4 years ago by ramitbhalla

No it's a good point you brought up. I am using a cookie cutter template that can apply to a broad range of videos (since this is part of MCEBuddy development), there is no way to tell if the end user has any particular video, so just going by statistical majority, most users had interlaced videos plus (importantly) the effects of applying a yadif filter to telecined video is not as bad as not applying to a interlaced video.
So you see where I'm coming from, but I completely get your point, if idet can help determine (need to see at the expense of what?, right now it takes a LONG TIME to run a full video detection) whether it's worth running the idet filter vs the results produced.

Note: See TracTickets for help on using tickets.