#977 closed defect (fixed)
stream copy duration does not match the one specified by -t when -ss is used
Reported by: | overclokkato | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | ffmpeg |
Version: | git-master | Keywords: | |
Cc: | svnpenn@gmail.com | Blocked By: | |
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
Hello,
i'm trying to cut an Adobe postprocessed F4v video (h.264 + mp3) with this command :
ffmpeg -ss 00:10:00 -t 10 -i c:\video.f4v -vcodec copy -acodec copy -f flv -async 1 videoout.f4v
but the output file duration is inaccurate;in my case 12 second and not 10 second .
If i try to insert an odd number in -ss (for example -ss 00:10:00) i have this issue while an even number the duration is correct.
Can you help me to resolve this issue ?
Is the command above right?
I tried to download last ffmpeg version and compile one version too but with the same results,
Thanks a lot in advance
Best regards
Change History (11)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Component: | FFmpeg → undetermined |
---|---|
Keywords: | f4v cutted inaccurate duration removed |
Priority: | critical → normal |
Please provide a sample and complete, uncut console output.
comment:3 by , 13 years ago
Hi,
of course :
C:\ffmpeg-r26400-swscale-r32676-mingw32-static\bin>ffmpeg.exe -ss 00:20:13 -t 00
:00:57 -i tagliato.f4v -vcodec copy -acodec copy -f flv -async 1 -y tagliato_out
_test1.f4v
FFmpeg version SVN-r26400, Copyright (c) 2000-2011 the FFmpeg developers
built on Jan 18 2011 04:07:05 with gcc 4.4.2
configuration: --enable-gpl --enable-version3 --enable-libgsm --enable-libvorb
is --enable-libtheora --enable-libspeex --enable-libmp3lame --enable-libopenjpeg
--enable-libschroedinger --enable-libopencore_amrwb --enable-libopencore_amrnb
--enable-libvpx --disable-decoder=libvpx --arch=x86 --enable-runtime-cpudetect -
-enable-libxvid --enable-libx264 --enable-librtmp --extra-libs='-lrtmp -lpolarss
l -lws2_32 -lwinmm' --target-os=mingw32 --enable-avisynth --enable-w32threads --
cross-prefix=i686-mingw32- --cc='ccache i686-mingw32-gcc' --enable-memalign-hack
libavutil 50.36. 0 / 50.36. 0
libavcore 0.16. 1 / 0.16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52.93. 0 / 52.93. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1.74. 0 / 1.74. 0
libswscale 0.12. 0 / 0.12. 0
[flv @ 02dc1380] Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 24.00 (24/1)
-> 25.00 (25/1)
Input #0, flv, from 'tagliato.f4v':
Metadata:
duration : 1757
width : 352
height : 288
videodatarate : 244
framerate : 1000
videocodecid : 7
audiodatarate : 31
audiosamplerate : 22050
audiosamplesize : 16
stereo : false
audiocodecid : 2
major_brand : f4v
minor_version : 0
compatible_brands: isommp42m4v
creation_time : 2033-01-13 05:07:24
encoder : Lavf53.12.0
filesize : 63495036
Duration: 00:29:17.01, start: 0.080000, bitrate: 281 kb/s
Stream #0.0: Video: h264, yuv420p, 352x288 [PAR 1:1 DAR 11:9], 249 kb/s, 25
tbr, 1k tbn, 24 tbc
Stream #0.1: Audio: mp3, 22050 Hz, 1 channels, s16, 32 kb/s
Output #0, flv, to 'tagliato_out_test1.f4v':
Metadata:
duration : 1757
width : 352
height : 288
videodatarate : 244
framerate : 1000
videocodecid : 7
audiodatarate : 31
audiosamplerate : 22050
audiosamplesize : 16
stereo : false
audiocodecid : 2
major_brand : f4v
minor_version : 0
compatible_brands: isommp42m4v
creation_time : 2033-01-13 05:07:24
filesize : 63495036
encoder : Lavf52.93.0
Stream #0.0: Video: libx264, yuv420p, 352x288 [PAR 1:1 DAR 11:9], q=2-31, 24
9 kb/s, 1k tbn, 12 tbc
Stream #0.1: Audio: libmp3lame, 22050 Hz, 1 channels, 32 kb/s
Stream mapping:
Press [q] to stop encoding
frame= 716 fps= 0 q=-1.0 Lsize= 2114kB time=56.94 bitrate= 304.2kbits/s
video:1832kB audio:232kB global headers:0kB muxing overhead 2.444589%
C:\ffmpeg-r26400-swscale-r32676-mingw32-static\bin>
And the duration is 59 second instead of 57 second. below the output
C:\ffmpeg-r26400-swscale-r32676-mingw32-static\bin>ffmpeg -i tagliato_out_test1.
f4v
FFmpeg version SVN-r26400, Copyright (c) 2000-2011 the FFmpeg developers
built on Jan 18 2011 04:07:05 with gcc 4.4.2
configuration: --enable-gpl --enable-version3 --enable-libgsm --enable-libvorb
is --enable-libtheora --enable-libspeex --enable-libmp3lame --enable-libopenjpeg
--enable-libschroedinger --enable-libopencore_amrwb --enable-libopencore_amrnb
--enable-libvpx --disable-decoder=libvpx --arch=x86 --enable-runtime-cpudetect -
-enable-libxvid --enable-libx264 --enable-librtmp --extra-libs='-lrtmp -lpolarss
l -lws2_32 -lwinmm' --target-os=mingw32 --enable-avisynth --enable-w32threads --
cross-prefix=i686-mingw32- --cc='ccache i686-mingw32-gcc' --enable-memalign-hack
libavutil 50.36. 0 / 50.36. 0
libavcore 0.16. 1 / 0.16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52.93. 0 / 52.93. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1.74. 0 / 1.74. 0
libswscale 0.12. 0 / 0.12. 0
[flv @ 01a6bc50] Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 24.00 (24/1)
-> 25.00 (25/1)
Input #0, flv, from 'tagliato_out_test1.f4v':
Metadata:
stereo : false
duration : 1757
width : 352
height : 288
videodatarate : 244
framerate : 1000
videocodecid : 7
audiodatarate : 31
audiosamplerate : 22050
audiosamplesize : 16
audiocodecid : 2
major_brand : f4v
minor_version : 0
compatible_brands: isommp42m4v
creation_time : 2033-01-13 05:07:24
encoder : Lavf52.93.0
filesize : 2165108
Duration: 00:00:59.76, start: 0.025000, bitrate: 281 kb/s
Stream #0.0: Video: h264, yuv420p, 352x288 [PAR 1:1 DAR 11:9], 249 kb/s, 25
tbr, 1k tbn, 24 tbc
Stream #0.1: Audio: mp3, 22050 Hz, 1 channels, s16, 32 kb/s
At least one output file must be specified
comment:4 by , 13 years ago
Please provide a sample.
Does it work if you move "-ss 00:20:13" behind "-i tagliato.f4v"?
comment:5 by , 13 years ago
Yes,i tried but Result don't change,in fact I see that if i use -f flv, the duration is inaccurate so
i searched another solution and i found ffmbc command line that use the same ffmpg syntax.
In the codecs archive i found f4v (ffmbc -codecs |grep f4v , while in ffmpeg this format doesn't exist) and cropped f4v works perfectly with correct duration.
the question is :'why ffmpeg doesn't work?'i think that perheaps depend by libav library.
If you find a solution please tell me.
Thanks a lot for your support.
comment:6 by , 13 years ago
Reproduced by developer: | set |
---|---|
Status: | new → open |
Version: | unspecified → git-master |
My suggestion was not helpful, -vcodec copy does not work well with -ss after -i, sorry.
Reproducible with the sample from ticket #578 (and probably many others):
$ ffmpeg -ss 11 -t 9 -i fails_open_cut.f4v -acodec copy -vcodec copy out.mov ffmpeg version N-37798-gcd1c12b Copyright (c) 2000-2012 the FFmpeg developers built on Feb 12 2012 01:52:42 with gcc 4.5.3 configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc libavutil 51. 39.100 / 51. 39.100 libavcodec 54. 1.100 / 54. 1.100 libavformat 54. 0.100 / 54. 0.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 62.100 / 2. 62.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 6.100 / 0. 6.100 [h264 @ 0x13d8340] Missing reference picture [h264 @ 0x13d8340] decode_slice_header error [h264 @ 0x13d8340] concealing 576 DC, 576 AC, 576 MV errors Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fails_open_cut.f4v': Metadata: major_brand : f4v minor_version : 0 compatible_brands: isommp42m4v creation_time : 2016-04-05 03:31:16 Duration: 00:01:44.93, start: 0.000000, bitrate: 609 kb/s Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 512x288 [SAR 1:1 DAR 16:9], 501 kb/s, 25 tbr, 1k tbn, 50 tbc Metadata: creation_time : 2016-04-05 03:31:16 handler_name : MainConcept Stream #0:1(eng): Audio: mp3 (.mp3 / 0x33706D2E), 22050 Hz, mono, s16, 48 kb/s Metadata: creation_time : 2016-04-05 03:31:16 handler_name : MP3 Sound Media Handler Output #0, mov, to 'out.mov': Metadata: major_brand : f4v minor_version : 0 compatible_brands: isommp42m4v creation_time : 2016-04-05 03:31:16 encoder : Lavf54.0.100 Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 512x288 [SAR 1:1 DAR 16:9], q=2-31, 501 kb/s, 1k tbn, 1k tbc Metadata: creation_time : 2016-04-05 03:31:16 handler_name : MainConcept Stream #0:1(eng): Audio: mp3 (.mp3 / 0x33706D2E), 22050 Hz, mono, 48 kb/s Metadata: creation_time : 2016-04-05 03:31:16 handler_name : MP3 Sound Media Handler Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 251 fps= 0 q=-1.0 Lsize= 665kB time=00:00:08.96 bitrate= 607.6kbits/s video:597kB audio:59kB global headers:0kB muxing overhead 1.382583% $ ffmpeg -i out.mov -f null - ffmpeg version N-37798-gcd1c12b Copyright (c) 2000-2012 the FFmpeg developers built on Feb 12 2012 01:52:42 with gcc 4.5.3 configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc libavutil 51. 39.100 / 51. 39.100 libavcodec 54. 1.100 / 54. 1.100 libavformat 54. 0.100 / 54. 0.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 62.100 / 2. 62.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 6.100 / 0. 6.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mov': Metadata: major_brand : qt minor_version : 512 compatible_brands: qt creation_time : 2016-04-05 03:31:16 encoder : Lavf54.0.100 Duration: 00:00:10.06, start: 0.000000, bitrate: 541 kb/s Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 512x288 [SAR 1:1 DAR 16:9], 486 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc Metadata: creation_time : 2016-04-05 03:31:16 handler_name : DataHandler Stream #0:1(eng): Audio: mp3 (.mp3 / 0x33706D2E), 22050 Hz, mono, s16, 47 kb/s Metadata: creation_time : 2016-04-05 03:31:16 handler_name : DataHandler [buffer @ 0x13f5740] w:512 h:288 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param: Output #0, null, to 'pipe:': Metadata: major_brand : qt minor_version : 512 compatible_brands: qt creation_time : 2016-04-05 03:31:16 encoder : Lavf54.0.100 Stream #0:0(eng): Video: rawvideo (I420 / 0x30323449), yuv420p, 512x288 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 25 tbc Metadata: creation_time : 2016-04-05 03:31:16 handler_name : DataHandler Stream #0:1(eng): Audio: pcm_s16le, 22050 Hz, mono, s16, 352 kb/s Metadata: creation_time : 2016-04-05 03:31:16 handler_name : DataHandler Stream mapping: Stream #0:0 -> #0:0 (h264 -> rawvideo) Stream #0:1 -> #0:1 (mp3 -> pcm_s16le) Press [q] to stop, [?] for help frame= 251 fps= 0 q=0.0 Lsize= 0kB time=00:00:10.04 bitrate= 0.0kbits/s video:0kB audio:434kB global headers:0kB muxing overhead -100.000000%
comment:7 by , 12 years ago
Component: | undetermined → FFmpeg |
---|---|
Summary: | F4v Cutted output video duration incaccurate,Why? → stream copy duration does not match the one specified by -t when -ss is used |
comment:8 by , 9 years ago
I have a similar issue, I don't know if they are same bug:
I want to strip only audio from a video file, so I issued
ffmpeg -report -y -ss '00:05:52.5' -t '30.1' -i '犯罪心理.Criminal.Minds.S11E01.中英字幕.HDTVrip.1024X576.mp4' -vn -c:a copy 'CriminalMinds-start.m4a'
The expected duration of output audio file is 30.1 seconds, but the real duration of output file is 06:22.60
size= 6058kB time=00:06:22.60 bitrate= 129.7kbits/s
It looks like the actual duration of output file is ${start position in time lengty}(-ss) + ${duration}(-t)
A workaround (thanks Fyr in #ffmpeg IRC channel) is: put the -t <duration> options after -i <input-file> options. that is: make -t <duration> option an OUTPUT OPTION.
ffmpeg -report -y -ss '00:05:52.5' -i '犯罪心理.Criminal.Minds.S11E01.中英字幕.HDTVrip.1024X576.mp4' -t '30.1' -vn -c:a copy 'CriminalMinds-start.m4a'
comment:9 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
comment:10 by , 9 years ago
If I use "-ss", "-t" and "-c copy", the duration is reduced, but not the
reported duration. This happens with "-ss -t -i", "-ss -i -t" and "-i -ss -t"
comment:11 by , 9 years ago
Cc: | added |
---|
might be related to the placing of key frames, h.264 streams are only cut-able at key frames,..