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

Tom Evans tevans.uk at googlemail.com
Mon Jan 9 18:42:44 CET 2012


On Sat, Jan 7, 2012 at 9:31 AM, Ly Tran Cong <lytc at vega.com.vn> wrote:
> Hi all,
>
> I'm trying to use ffmpeg to create mpegts segment for Iphone every 10
> second.
> Here is my command
>
> ffmpeg -y -i udp://239.30.10.6:5106?reuse=1 -c:v libx264 -b:v 150k -s
> 320x240 -c:a libfaac -b:a 48k -ar 48000 -map 0 -f segment -segment_time 10
> -segment_pattern %05d.ts -segment_basename test test.m3u8
>
> And I got the following segment: test00001.ts, test00002.ts but this is
> "nut/multimedia container" so Iphone cannot play this segment.
> I also try using parameter "container_format mpegts" or "container_format
> ts" but I got the following error
>
> Output #0, segment, to 'list.m3u8':
>  Metadata:
>    encoder         : Lavf53.24.0
>    Stream #0:0: Video: h264, yuv420p, 320x240 [SAR 45:44 DAR 15:11],
> q=-1--1, 150 kb/s, 90k tbn, 50 tbc
>    Stream #0:1: Audio: aac, 48000 Hz, stereo, s16, 48 kb/s
> Stream mapping:
>  Stream #0:0 -> #0:0 (h264 -> libx264)
>  Stream #0:1 -> #0:1 (mp2 -> libfaac)
> Could not write header for output file #0 (incorrect codec parameters ?)
>
> How can I use segment muxer to create mpegts every 10 second?
> Please help me
>

You can use one of many separate utilities for segmenting TS:

https://github.com/johnf/m3u8-segmenter
http://www.ioncannon.net/programming/452/iphone-http-streaming-with-ffmpeg-and-an-open-source-segmenter/


Using the first one is simple:

ffmpeg <args> -f mpegts - \
  | m3u8-segmenter -i - -d 10 -p test -m test.m3u8 -u http://yourwebsite/path/

Cheers

Tom


More information about the ffmpeg-user mailing list