Opened 13 years ago
Closed 13 years ago
#2771 closed defect (invalid)
-segment_time generates unexpected file lengths
| Reported by: | Acc72 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | git-master | Keywords: | segment |
| Cc: | raptorderojo@gmail.com | Blocked By: | |
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Hello,
I'm attempting to utilize the segmenter on an A/V stream, from my USB webcam. With the -segment_time option, I've configured ffmpeg to output a circular series of four (4) mp4 files, each three (3) seconds in length. However, ffmpeg generates files which are sixteen (16) seconds in length. Occasionally, random files are generated at shorter lengths (2 sec, 3 sec, 8 sec, etc...). However, most of them are generated sixteen (16) seconds in length.
Results change, if I play with the value for -segment_time:
(-Segment_time < 16) all 4 files generated @ 16 seconds.
(-segment_time >= 16) 1st file generated @ 33 seconds and all subsequent files generated @ 16 seconds.
Not sure why this is happening???
Zeranoe official build: ffmpeg-20130706-git-63d7684-win32-static
ffmpeg command line:
ffmpeg -f dshow -rtbufsize 10M -pix_fmt yuv420p -s 640x480 -ac 1 -i video="Logitech HD Webcam C310":audio="Microphone (HD Webcam C310)" -r 15 -vcodec libx264 -preset fast -crf 22 -b:v 250k -acodec libvo_aacenc -ar 8k -b:a 96k -ac 1 -f segment -map 0 -reset_timestamps 1 -segment_time 3 -segment_wrap 4 "out%2d.mp4"
Output:
ffmpeg version N-54499-g63d7684 Copyright (c) 2000-2013 the FFmpeg developers
built on Jul 6 2013 10:30:06 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-fr
ei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable
-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-
libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-
libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-z
lib
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 11.101 / 55. 11.101
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 78.102 / 3. 78.102
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, dshow, from 'video=Logitech HD Webcam C310:audio=Microphone (HD Webcam C310)':
Duration: N/A, start: 76871.688000, bitrate: 705 kb/s
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x480, 30 tbr, 10000k tbn, 30 tbc
Stream #0:1: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
[libx264 @ 04289b20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 04289b20] profile High, level 2.2
[libx264 @ 04289b20] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html -
options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 tre
llis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 key
int=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=22.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ra
tio=1.40 aq=1:1.00
Output #0, segment, to 'out%2d.mp4':
Metadata:
encoder : Lavf55.11.101
Stream #0:0: Video: h264 (libx264), yuv420p, 640x480, q=-1--1, 250 kb/s, 90k tbn, 15 tbc
Stream #0:1: Audio: aac (libvo_aacenc), 8000 Hz, mono, s16, 96 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> libx264)
Stream #0:1 -> #0:1 (pcm_s16le -> libvo_aacenc)
Press [q] to stop, [?] for help
frame= 1164 fps= 15 q=-1.0 Lsize=N/A time=00:01:17.46 bitrate=N/A dup=19 drop=1131
video:5204kB audio:101kB subtitle:0 global headers:0kB muxing overhead -100.000405%
[libx264 @ 04289b20] frame I:5 Avg QP:16.94 size: 57563
[libx264 @ 04289b20] frame P:331 Avg QP:20.45 size: 10496
[libx264 @ 04289b20] frame B:828 Avg QP:23.23 size: 1891
[libx264 @ 04289b20] consecutive B-frames: 0.9% 6.5% 19.1% 73.5%
[libx264 @ 04289b20] mb I I16..4: 2.3% 59.4% 38.3%
[libx264 @ 04289b20] mb P I16..4: 0.3% 2.4% 0.7% P16..4: 49.4% 24.4% 16.6% 0.0% 0.0% skip: 6.3%
[libx264 @ 04289b20] mb B I16..4: 0.5% 0.6% 0.1% B16..8: 17.0% 3.6% 0.2% direct:24.4% skip:53.4% L0:39.3% L1:43.2% BI:17.5%
[libx264 @ 04289b20] 8x8 transform intra:61.3% inter:65.3%
[libx264 @ 04289b20] coded y,uvDC,uvAC intra: 65.6% 95.7% 80.1% inter: 15.6% 47.7% 14.1%
[libx264 @ 04289b20] i16 v,h,dc,p: 17% 32% 37% 14%
[libx264 @ 04289b20] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 22% 26% 4% 7% 6% 9% 6% 8%
[libx264 @ 04289b20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 25% 10% 6% 9% 8% 11% 7% 7%
[libx264 @ 04289b20] i8c dc,h,v,p: 52% 22% 15% 11%
[libx264 @ 04289b20] Weighted P-Frames: Y:2.7% UV:2.7%
[libx264 @ 04289b20] ref P L0: 54.9% 45.1%
[libx264 @ 04289b20] ref B L0: 69.7% 30.3%
[libx264 @ 04289b20] ref B L1: 92.2% 7.8%
[libx264 @ 04289b20] kb/s:549.25
[dshow @ 0289c000] real-time buffer 74% full! frame dropped!
Change History (4)
comment:1 by , 13 years ago
| Cc: | added |
|---|---|
| Version: | unspecified → git-master |
follow-up: 3 comment:2 by , 13 years ago
| Priority: | important → normal |
|---|
comment:3 by , 13 years ago
Replying to cehoyos:
Is this a regression?
Is the problem only reproducible with external libraries (x264, libvo_aac) or also with
-vcodec mpeg4 -strict -2 -acodec aac?
Sorry, I don't understand your question... Regression?
When using your suggested options: -vcodec mpeg4 -strict -2 -acodec aac, ffmpeg generates 3 of the 4 files @ segment_time. However, 1 file is usually generated @ segment_time - 1 or -2.
comment:4 by , 13 years ago
| Component: | undetermined → avformat |
|---|---|
| Keywords: | segment added |
| Resolution: | → invalid |
| Status: | new → closed |
Replying to Acc72:
Hello,
I'm attempting to utilize the segmenter on an A/V stream, from my USB webcam. With the -segment_time option, I've configured ffmpeg to output a circular series of four (4) mp4 files, each three (3) seconds in length. However, ffmpeg generates files which are sixteen (16) seconds in length. Occasionally, random files are generated at shorter lengths (2 sec, 3 sec, 8 sec, etc...). However, most of them are generated sixteen (16) seconds in length.
Results change, if I play with the value for -segment_time:
(-Segment_time < 16) all 4 files generated @ 16 seconds.
(-segment_time >= 16) 1st file generated @ 33 seconds and all subsequent files generated @ 16 seconds.
Not sure why this is happening???
This is expected, from the docs:
Every segment starts with a keyframe of the selected reference stream, which is set through the reference_stream option.
Note that if you want accurate splitting for a video file, you need to make the input key frames correspond to the exact splitting times expected by the segmenter, or the segment muxer will start the new segment with the key frame found next after the specified start time.
...
You can use the ffmpeg -force_key_frames option to force key-frames, read the examples in the segment manual.
[...]



Is this a regression?
Is the problem only reproducible with external libraries (x264, libvo_aac) or also with
-vcodec mpeg4 -strict -2 -acodec aac?