[FFmpeg-user] Qüestion on segment muxer with h.264 over mp4 and reproducing segments as standalone movies

Hector Cano hcano at mebcn.com
Tue Jun 5 14:56:18 CEST 2012

I am trying to use ffmpeg to record a video stream from an IP càmera
(Axis 210). I am using segment to split the output in 10 second chunks
and generate a playing list. Everything goes pretty well, but I have
difficulties when playing the clips on VLC or Quicktime.
I use mp4 format, with h.264 codec.
If I open the playlist on VLC the first clip plays smoothly. Then I
have 10 seconds where VLC counter is working, but no video is played,
then the second clip is played (while the time counter goes up to
something like 20/10). Then 20 seconds pause, and increasing for every
In quicktime I can only get 10 seconds of blanc screen (actually
black) and it stops without ever playing vídeo (except the first chunk
that plays smoothly.

I could only find ticket Ticket #910 , closed as invalid. I asume then
that this is the intended behaviour.
If this is the case, is this a VLC and QuickTime bug? Is there any way
to tell VLC and/or QuickTime to play those clips?
I am quite newbie, and I have the feeling that there's something I am
missing. Any help would be appreciated.

If I use mpegts format everything plays ok (though ffprobe gives the
same start time as for the mp4 files). Unfortunatedly at this moment
mp4 is a requirement.

Console output:

$ ffmpeg -i "rtsp://" \
>   -map 0 \
>   -c:v libx264 -profile:v baseline -preset fast -g 16 \
>   -t 30 -f segment \
>   -segment_time 10 -segment_format mp4 \
>   -segment_list test.m3u8 -segment_list_size 30 \
>   test%03d.mp4
ffmpeg version N-40962-g0da28d6 Copyright (c) 2000-2012 the FFmpeg developers
  built on May 23 2012 16:23:18 with gcc 4.6.1
  configuration: --enable-gpl --enable-libx264 --enable-x11grab
  libavutil      51. 53.100 / 51. 53.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 76.100 /  2. 76.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rtsp @ 0xa9a23c0] Estimating duration from bitrate, this may be inaccurate
Input #0, rtsp, from 'rtsp://':
    title           : Media Presentation
  Duration: N/A, start: 0.023344, bitrate: N/A
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile), yuv420p,
640x480 [SAR 1:1 DAR 4:3], 100 tbr, 90k tbn, 100 tbc
[buffer @ 0xa9d4740] w:640 h:480 pixfmt:yuv420p tb:1/90000 sar:1/1
[buffersink @ 0xa9d48c0] No opaque field provided
[libx264 @ 0xa9d50c0] using SAR=1/1
[libx264 @ 0xa9d50c0] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle Cache64
[libx264 @ 0xa9d50c0] profile Constrained Baseline, level 3.2
[libx264 @ 0xa9d50c0] 264 - core 125 r2200 999b753 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html -
options: cabac=0 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=6
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0
keyint=16 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=16
rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4
ip_ratio=1.40 aq=1:1.00
Output #0, segment, to 'test%03d.mp4':
    title           : Media Presentation
    encoder         : Lavf54.6.100
    Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 640x480
[SAR 1:1 DAR 4:3], q=-1--1, 100 tbn, 100 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> libx264)
Press [q] to stop, [?] for help
frame=   52 fps=0.0 q=33.0 size=       0kB time=00:00:00.32 bitrate=
0.0kbits/frame=  105 fps= 97 q=33.0 size=       0kB time=00:00:00.85
bitrate=   0.0kbits/frame=  159 fps= 99 q=33.0 size=       0kB
time=00:00:01.39 bitrate=   0.0kbits/frame=  212 fps=100 q=33.0 size=
     0kB time=00:00:01.92 bitrate=   0.0kbits/frame=  265 fps=100
q=33.0 size=       0kB time=00:00:02.45 bitrate=   0.0kbits/frame=
315 fps=100 q=33.0 size=       0kB time=00:00:02.95 bitrate=
0.0kbits/frame=  369 fps=101 q=33.0 size=       0kB time=00:00:03.49
bitrate=   0.0kbits/frame=  419 fps=101 q=30.0 size=       0kB
time=00:00:03.99 bitrate=   0.0kbits/frame=  472 fps=100 q=33.0 size=
     0kB time=00:00:04.52 bitrate=   0.0kbits/frame=  525 fps=100
q=33.0 size=       0kB time=00:00:05.05 bitrate=   0.0kbits/frame=
572 fps=100 q=33.0 size=       0kB time=00:00:05.52 bitrate=
0.0kbits/frame=  625 fps=100 q=33.0 size=       0kB time=00:00:06.05
bitrate=   0.0kbits/frame=  675 fps=100 q=30.0 size=       0kB
time=00:00:06.55 bitrate=   0.0kbits/frame=  725 fps=100 q=33.0 size=
     0kB time=00:00:07.05 bitrate=   0.0kbits/frame=  775 fps=100
q=33.0 size=       0kB time=00:00:07.55 bitrate=   0.0kbits/frame=
829 fps=100 q=33.0 size=       0kB time=00:00:08.09 bitrate=
0.0kbits/frame=  879 fps=100 q=33.0 size=       0kB time=00:00:08.59
bitrate=   0.0kbits/frame=  929 fps=100 q=33.0 size=       0kB
time=00:00:09.09 bitrate=   0.0kbits/frame=  982 fps=100 q=33.0 size=
     0kB time=00:00:09.62 bitrate=   0.0kbits/frame= 1032 fps=100
q=33.0 size=       0kB time=00:00:10.12 bitrate=   0.0kbits/frame=
1085 fps=100 q=33.0 size=       0kB time=00:00:10.65 bitrate=
0.0kbits/frame= 1129 fps=100 q=33.0 size=       0kB time=00:00:11.09
bitrate=   0.0kbits/frame= 1189 fps=100 q=33.0 size=       0kB
time=00:00:11.69 bitrate=   0.0kbits/frame= 1242 fps=100 q=33.0 size=
     0kB time=00:00:12.22 bitrate=   0.0kbits/frame= 1289 fps=100
q=33.0 size=       0kB time=00:00:12.69 bitrate=   0.0kbits/frame=
1346 fps=100 q=33.0 size=       0kB time=00:00:13.26 bitrate=
0.0kbits/frame= 1399 fps=100 q=33.0 size=       0kB time=00:00:13.79
bitrate=   0.0kbits/frame= 1449 fps=100 q=33.0 size=       0kB
time=00:00:14.29 bitrate=   0.0kbits/frame= 1509 fps=100 q=33.0 size=
     0kB time=00:00:14.89 bitrate=   0.0kbits/frame= 1559 fps=100
q=33.0 size=       0kB time=00:00:15.39 bitrate=   0.0kbits/frame=
1612 fps=100 q=33.0 size=       0kB time=00:00:15.92 bitrate=
0.0kbits/frame= 1666 fps=100 q=33.0 size=       0kB time=00:00:16.46
bitrate=   0.0kbits/frame= 1716 fps=100 q=33.0 size=       0kB
time=00:00:16.96 bitrate=   0.0kbits/frame= 1769 fps=100 q=33.0 size=
     0kB time=00:00:17.49 bitrate=   0.0kbits/frame= 1826 fps=100
q=33.0 size=       0kB time=00:00:18.06 bitrate=   0.0kbits/frame=
1879 fps=100 q=33.0 size=       0kB time=00:00:18.59 bitrate=
0.0kbits/frame= 1932 fps=100 q=33.0 size=       0kB time=00:00:19.12
bitrate=   0.0kbits/frame= 1989 fps=100 q=33.0 size=       0kB
time=00:00:19.69 bitrate=   0.0kbits/frame= 2039 fps=100 q=33.0 size=
     0kB time=00:00:20.19 bitrate=   0.0kbits/frame= 2089 fps=100
q=33.0 size=       0kB time=00:00:20.69 bitrate=   0.0kbits/frame=
2146 fps=100 q=33.0 size=       0kB time=00:00:21.26 bitrate=
0.0kbits/frame= 2196 fps=100 q=33.0 size=       0kB time=00:00:21.76
bitrate=   0.0kbits/frame= 2249 fps=100 q=33.0 size=       0kB
time=00:00:22.29 bitrate=   0.0kbits/frame= 2306 fps=100 q=33.0 size=
     0kB time=00:00:22.86 bitrate=   0.0kbits/frame= 2359 fps=100
q=33.0 size=       0kB time=00:00:23.39 bitrate=   0.0kbits/frame=
2412 fps=100 q=33.0 size=       0kB time=00:00:23.92 bitrate=
0.0kbits/frame= 2469 fps=100 q=33.0 size=       0kB time=00:00:24.49
bitrate=   0.0kbits/frame= 2519 fps=100 q=33.0 size=       0kB
time=00:00:24.99 bitrate=   0.0kbits/frame= 2569 fps=100 q=33.0 size=
     0kB time=00:00:25.49 bitrate=   0.0kbits/frame= 2626 fps=100
q=33.0 size=       0kB time=00:00:26.06 bitrate=   0.0kbits/frame=
2676 fps=100 q=33.0 size=       0kB time=00:00:26.56 bitrate=
0.0kbits/frame= 2729 fps=100 q=33.0 size=       0kB time=00:00:27.09
bitrate=   0.0kbits/frame= 2786 fps=100 q=33.0 size=       0kB
time=00:00:27.66 bitrate=   0.0kbits/frame= 2836 fps=100 q=33.0 size=
     0kB time=00:00:28.16 bitrate=   0.0kbits/frame= 2889 fps=100
q=33.0 size=       0kB time=00:00:28.69 bitrate=   0.0kbits/frame=
2939 fps=100 q=33.0 size=       0kB time=00:00:29.19 bitrate=
0.0kbits/frame= 2992 fps=100 q=33.0 size=       0kB time=00:00:29.72
bitrate=   0.0kbits/frame= 2999 fps=100 q=4960891.0 Lsize=       0kB
time=00:00:29.99 bitrate=   0.0kbits/s dup=2202 drop=0
video:11901kB audio:0kB global headers:0kB muxing overhead -100.000000%
[libx264 @ 0xa9d50c0] frame I:188   Avg QP:25.36  size: 62847
[libx264 @ 0xa9d50c0] frame P:2811  Avg QP:27.65  size:   132
[libx264 @ 0xa9d50c0] mb I  I16..4:  8.6%  0.0% 91.4%
[libx264 @ 0xa9d50c0] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  3.2%
0.1%  0.1%  0.0%  0.0%    skip:96.6%
[libx264 @ 0xa9d50c0] coded y,uvDC,uvAC intra: 87.8% 96.8% 83.6%
inter: 0.2% 1.0% 0.0%
[libx264 @ 0xa9d50c0] i16 v,h,dc,p:  7% 54% 21% 17%
[libx264 @ 0xa9d50c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 34%  9%  5%
6%  4% 11%  4%  8%
[libx264 @ 0xa9d50c0] i8c dc,h,v,p: 57% 24% 11%  8%
[libx264 @ 0xa9d50c0] ref P L0: 40.9% 59.1%
[libx264 @ 0xa9d50c0] kb/s:3250.57


More information about the ffmpeg-user mailing list