#5340 closed defect (worksforme)
ffmpeg with WMV input renders incorrect audio length (with some codecs)
Reported by: | veganaiZe | 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 converting a (20 FPS) WMV video to another video/container format with particular audio (output) codecs, including "-acodec copy", the resulting audio length is incorrect (It's supposed to be 9m:51s, but it's 10m:18s).
How to reproduce:
Download the sample WMV video...
% ffmpeg -i <infile>.wmv -map 0:v -vcodec libx264 video.avi -map 0:a -acodec aac audio.aac
However, if I use ".m4a" as the extension, instead of ".aac" everything seems fine (when played with MPC-HC x64 v1.7.10)
The following command also exhibits similar issues...
% ffmpeg -i <infile>.wmv -vcodec libx264 -acodec copy outfile.avi
Change History (14)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Keywords: | wmv sync removed |
---|
I tested the following and cannot reproduce the issue:
$ ffmpeg -i ScreenCapture_2-28-2016\ 12.45.57\ PM.wmv out.aac ffmpeg version N-79057-gfa3eecf Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.7 (SUSE Linux) configuration: --enable-gpl libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 28.103 / 57. 28.103 libavformat 57. 28.102 / 57. 28.102 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 39.102 / 6. 39.102 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, asf, from 'ScreenCapture_2-28-2016 12.45.57 PM.wmv': Metadata: VBR Peak : 4569000 DeviceConformanceTemplate: AP WM/WMADRCPeakReference: 15798 WM/WMADRCPeakTarget: 15798 WM/WMADRCAverageReference: 536 WM/WMADRCAverageTarget: 536 WMFSDKVersion : 12.0.9600.17415 WMFSDKNeeded : 0.0.0.0000 IsVBR : 1 Duration: 00:09:51.39, start: 0.000000, bitrate: 353 kb/s Stream #0:0(eng): Audio: wmapro (b[1][0][0] / 0x0162), 44100 Hz, stereo, fltp, 64 kb/s Stream #0:1(eng): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1068x640 [SAR 139:139 DAR 267:160], 2664 kb/s, 20 tbr, 1k tbn, 40 tbc Output #0, adts, to 'out.aac': Metadata: VBR Peak : 4569000 DeviceConformanceTemplate: AP WM/WMADRCPeakReference: 15798 WM/WMADRCPeakTarget: 15798 WM/WMADRCAverageReference: 536 WM/WMADRCAverageTarget: 536 WMFSDKVersion : 12.0.9600.17415 WMFSDKNeeded : 0.0.0.0000 IsVBR : 1 encoder : Lavf57.28.102 Stream #0:0(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc57.28.103 aac Stream mapping: Stream #0:0 -> #0:0 (wmapro (native) -> aac (native)) Press [q] to stop, [?] for help [aac @ 0x3a82760] Queue input is backward in timeits/s speed=25.8x [adts @ 0x3a81560] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 19174365 >= 19173357 size= 9407kB time=00:09:51.45 bitrate= 130.3kbits/s speed= 26x video:0kB audio:9233kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.885651% [aac @ 0x3a82760] Qavg: 29262.689
The output file is 9:51 afaict, what do I miss?
follow-up: 4 comment:3 by , 9 years ago
I get 10m:18s with your same command…
ffmpeg -i "..\ScreenCapture_2-28-2016 12.45.57 PM.wmv" out.aac
>ffmpeg -i "..\ScreenCapture_2-28-2016 12.45.57 PM.wmv" out.aac ffmpeg version N-79000-g66edd86 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -- enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l ibilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopenc ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --ena ble-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enabl e-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-l ibvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-li bwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enab le-libzimg --enable-lzma --enable-decklink --enable-zlib libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 28.100 / 57. 28.100 libavformat 57. 28.100 / 57. 28.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 39.102 / 6. 39.102 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, asf, from '..\ScreenCapture_2-28-2016 12.45.57 PM.wmv': Metadata: VBR Peak : 4569000 DeviceConformanceTemplate: AP WM/WMADRCPeakReference: 15798 WM/WMADRCPeakTarget: 15798 WM/WMADRCAverageReference: 536 WM/WMADRCAverageTarget: 536 WMFSDKVersion : 12.0.9600.17415 WMFSDKNeeded : 0.0.0.0000 IsVBR : 1 Duration: 00:09:51.39, start: 0.000000, bitrate: 353 kb/s Stream #0:0(eng): Audio: wmapro (b[1][0][0] / 0x0162), 44100 Hz, stereo, flt p, 64 kb/s Stream #0:1(eng): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1068x6 40 [SAR 139:139 DAR 267:160], 2664 kb/s, 20 tbr, 1k tbn, 40 tbc Output #0, adts, to 'out.aac': Metadata: VBR Peak : 4569000 DeviceConformanceTemplate: AP WM/WMADRCPeakReference: 15798 WM/WMADRCPeakTarget: 15798 WM/WMADRCAverageReference: 536 WM/WMADRCAverageTarget: 536 WMFSDKVersion : 12.0.9600.17415 WMFSDKNeeded : 0.0.0.0000 IsVBR : 1 encoder : Lavf57.28.100 Stream #0:0(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc57.28.100 aac Stream mapping: Stream #0:0 -> #0:0 (wmapro (native) -> aac (native)) Press [q] to stop, [?] for help [aac @ 0000006797781ca0] Queue input is backward in timepeed=9.82x [adts @ 00000067977809e0] Application provided invalid, non monotonically increa sing dts to muxer in stream 0: 19174365 >= 19173357 size= 9407kB time=00:09:51.45 bitrate= 130.3kbits/s speed= 9.9x video:0kB audio:9233kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.885614% [aac @ 0000006797781ca0] Qavg: 29138.799
And here is the result...
>ffmpeg -i out.aac ffmpeg version N-79000-g66edd86 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -- enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l ibilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopenc ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --ena ble-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enabl e-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-l ibvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-li bwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enab le-libzimg --enable-lzma --enable-decklink --enable-zlib libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 28.100 / 57. 28.100 libavformat 57. 28.100 / 57. 28.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 39.102 / 6. 39.102 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 [aac @ 0000002de955ae80] Estimating duration from bitrate, this may be inaccurat e Input #0, aac, from 'out.aac': Duration: 00:10:17.91, bitrate: 124 kb/s Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 124 kb/s At least one output file must be specified
Duration: 00:10:17.91
Microsoft Windows 8.1 (6.3.9600), 6GB RAM, x64 AMD A6-5200 APU w/ Radeon 8400 R3 series (512mb) Driver ver: 7.1.542.0
comment:4 by , 9 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Replying to veganaiZe:
[aac @ 0000002de955ae80] Estimating duration from bitrate, this may be inaccurate
What is unclear about this warning?
follow-up: 8 comment:5 by , 9 years ago
So should I manually specific the duration? BTW: The only thing that is clear is your attitude problem.
comment:7 by , 9 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
comment:8 by , 9 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
Replying to veganaiZe:
So should I manually specific the duration?
You cannot specify the duration: It is just shown as an information for the user, FFmpeg ignores it.
My playback time matches the "estimated" duration.
I still cannot reproduce:
$ ffmpeg -i ScreenCapture_2-28-2016\ 12.45.57\ PM.wmv out.aac
$ time ffplay -autoexit out.aac ffplay version N-79068-g6b7ce0e Copyright (c) 2003-2016 the FFmpeg developers built with gcc 4.7 (SUSE Linux) configuration: --enable-gpl libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 28.103 / 57. 28.103 libavformat 57. 28.102 / 57. 28.102 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 39.102 / 6. 39.102 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 [aac @ 0x7fde3c000920] Estimating duration from bitrate, this may be inaccurate Input #0, aac, from 'out.aac': Duration: 00:10:44.61, bitrate: 119 kb/s Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 119 kb/s 591.32 M-A: 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0 real 9m51.589s user 0m12.173s sys 0m7.817s
$ ffmpeg -i out.aac -f null - ffmpeg version N-79068-g6b7ce0e Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.7 (SUSE Linux) configuration: --enable-gpl libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 28.103 / 57. 28.103 libavformat 57. 28.102 / 57. 28.102 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 39.102 / 6. 39.102 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 [aac @ 0x386c3c0] Estimating duration from bitrate, this may be inaccurate Input #0, aac, from 'out.aac': Duration: 00:10:44.61, bitrate: 119 kb/s Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 119 kb/s Output #0, null, to 'pipe:': Metadata: encoder : Lavf57.28.102 Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s Metadata: encoder : Lavc57.28.103 pcm_s16le Stream mapping: Stream #0:0 -> #0:0 (aac (native) -> pcm_s16le (native)) Press [q] to stop, [?] for help size=N/A time=00:09:51.38 bitrate=N/A speed=1.16e+03x video:0kB audio:101876kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Which application plays the aac file for ten minutes?
follow-up: 10 comment:9 by , 9 years ago
MPC-HC reports 10m:18s time but stops the video (with a/v in sync) at 9m:51s... that's all good.
It would be nice if ffmpeg applied the correct duration, that it displays at the end of conversion, to the resulting output file. Because if I run ffprobe against it, right after conversion, it just uses the incorrect estimate (as does MPC-HC).
There seems to be no reasonable way to accomplish this with ffmpeg command-line switches.
Thank you.
comment:10 by , 9 years ago
Replying to veganaiZe:
It would be nice if ffmpeg applied the correct duration, that it displays at the end of conversion, to the resulting output file.
How would that work?
comment:11 by , 9 years ago
Resolution: | worksforme → invalid |
---|
follow-up: 13 comment:12 by , 9 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Why does my media player correctly report the time (before playback) for the original .WMV file, but not for the ffmpeg converted file?
Maybe there is some way to extract the correct duration information from the container's header and apply that?
I don't know... If you can't think of a way, that is okay by me. Feel free to close this bug out. Thank you for the assistance.
comment:13 by , 9 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
Replying to veganaiZe:
Why does my media player correctly report the time (before playback) for the original .WMV file, but not for the ffmpeg converted file?
Please test ffmpeg -i input out.asf && ffmpeg -i out.asf
to confirm that for asf files a duration is written in the file header. As you found out, this does not happen for aac files because aac files do not store the file duration. FFmpeg already prints a warning in this case.
Please stop reopening this ticket: Your claim was that FFmpeg output files are significantly longer than the input files, you forced me to test this (in realtime) with different media players but you have already confirmed that this is not the case.
comment:14 by , 9 years ago
I'm sorry. I was trying to hash out an issue in Blender's video sequence editor and I must have blurred the results in my mind. Thank you for your time & patience. FFmpeg is to video what Linux is to the CPU.
See the following files in FTP ...
1) WMV in question: "ScreenCapture_2-28-2016 12.45.57 PM.wmv"
2) Report log for first command: ffmpeg-20160315-091438.txt
(The report was just over the attachment limit)