[FFmpeg-user] Need help using segment muxer to create mpegts segment every 10 second.

Tom Evans tevans.uk at googlemail.com
Wed Jan 11 15:29:07 CET 2012


On Wed, Jan 11, 2012 at 10:14 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Please try current git head.
>

With git head from a few hours ago, I can get this to work for mpeg2
output, but not for x264.

So this works as expected:

ffmpeg -i /tank/video/scratch/ashes09-5.vob -r 25 \
    -c:a libfaac -ab:a 128k -ac:a 2 \
    -c:v mpeg2video -s:v 640x360 -aspect:v 16:9 -map 0 \
    -f segment -segment_time 10 -segment_list test.m3u8 \
    -segment_format mpegts stream%05d.ts

This does not:

ffmpeg -i /tank/video/scratch/ashes09-5.vob -r 25 \
    -c:a libfaac -ab:a 128k -ac:a 2 \
    -c:v libx264 -s:v 640x360 -aspect:v 16:9 -map 0 \
    -f segment -segment_time 10 -segment_list test.m3u8 \
    -segment_format mpegts stream%05d.ts

ffmpeg version N-36703-g98dfdfd Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan 11 2012 10:35:13 with gcc 4.6.2 20110729 (prerelease)
  configuration: --as=/usr/local/bin/as --cc=/usr/local/bin/gcc46
--extra-libs=-L/usr/local/lib --extra-cflags=-I/usr/local/include
--prefix=/usr/local --mandir=/usr/local/man --disable-protocol=udp
--enable-libx264 --enable-postproc --enable-libfaac
--enable-libmp3lame --enable-libxvid --enable-nonfree --enable-gpl
--enable-version3 --enable-libtheora --enable-libvorbis
--enable-ffmpeg --enable-ffplay --enable-ffprobe
  libavutil      51. 34.100 / 51. 34.100
  libavcodec     53. 54.100 / 53. 54.100
  libavformat    53. 29.100 / 53. 29.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 58.100 /  2. 58.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    51.  2.100 / 51.  2.100
[mpeg @ 0x803c3e600] max_analyze_duration 5000000 reached at 5000000
Input #0, mpeg, from '/tank/video/scratch/ashes09-5.vob':
  Duration: 00:00:11.00, start: 0.287267, bitrate: -2147483 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576
[SAR 64:45 DAR 16:9], 7800 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 224 kb/s
[buffer @ 0x803c23100] w:720 h:576 pixfmt:yuv420p tb:1/1000000
sar:64/45 sws_param:
[scale @ 0x803c23dc0] w:720 h:576 fmt:yuv420p -> w:640 h:360
fmt:yuv420p flags:0x4
[libx264 @ 0x803ecae00] using SAR=1/1
[libx264 @ 0x803ecae00] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle Cache64
[libx264 @ 0x803ecae00] profile High, level 3.0
[libx264 @ 0x803ecae00] 264 - core 118 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2011 - http://www.videolan.org/x264.html - options:
cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
threads=3 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=2 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
aq=1:1.00
[mpegts @ 0x803c42200] muxrate VBR, pcr every 2 pkts, sdt every 200,
pat/pmt every 40 pkts
Output #0, segment, to 'stream%05d.ts':
  Metadata:
    encoder         : Lavf53.29.100
    Stream #0:0: Video: h264, yuv420p, 640x360 [SAR 1:1 DAR 16:9],
q=-1--1, 90k tbn, 25 tbc
    Stream #0:1: Audio: aac, 48000 Hz, 2 channels, s16, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> libx264)
  Stream #0:1 -> #0:1 (ac3 -> libfaac)
Press [q] to stop, [?] for help
[mpegts @ 0x803c42200] H.264 bitstream malformed, no startcode found,
use -vbsf h264_mp4toannexb
av_interleaved_write_frame(): Operation not permitted

If I add the suggested bitstream filter, then this additional error is
output before the 'bitstream malformed' line:

h264_mp4toannexb failed for stream 0, codec libx264: Invalid argument

Source is a PAL MPEG2 ripped from DVD (if that matters).

Cheers

Tom


More information about the ffmpeg-user mailing list