BrrBr
BrrBr

Reputation: 974

ffmpeg rtmp webcam live stream iphone/pad segment size too big

I'm transcoding a rtmp stream from a red5 server for use to live stream on a iphone or ipad device. I built latest ffmpeg version from git repo using the built in segmenter to create .ts files and m3u8 playlist file using the following:

ffmpeg -probesize 50k -i "rtmp://localhost/oflaDemo/red5StreamDemo live=1" \
-c:v libx264 -b:v 128k -vpre ipod320 -flags -global_header -map 0 \
-f segment -segment_time 3 -segment_list foo.m3u8 -segment_list_flags +live \
-segment_list_type m3u8 -segment_list_size 5 -segment_format mpegts foo%d.ts

This works fine, but I can't get the segment size smaller than about 12 sec even set to 3 (-segment_time 3). It seems to be caused by libx264 vcodec. Am I missing any flag?

By the way, you can simple run the ffmpeg command above successfully by starting red5 SimpleBroadcaster example.

Upvotes: 1

Views: 2026

Answers (1)

rajneesh
rajneesh

Reputation: 1749

i suspect it is because of GOP size. segmenter needs I-frame boundary to be able to create segments.

ffmpeg -probesize 50k -i "rtmp://localhost/oflaDemo/red5StreamDemo live=1" \ -c:v libx264 -b:v 128k -g 90 -vpre ipod320 -flags -global_header -map 0 \ -f segment -segment_time 3 -segment_list foo.m3u8 -segment_list_flags +live \ -segment_list_type m3u8 -segment_list_size 5 -segment_format mpegts foo%d.ts

added -g 90. could help.

Upvotes: 2

Related Questions