[FFmpeg-user] ffmpeg segmenter starves when using -re and high bitrate

ulf johansson epkuson at gmail.com
Tue May 28 19:43:15 CEST 2013


Hi again,
anyone have any ideas to isolate/remedy the problem?
br
uffe


On Mon, May 27, 2013 at 8:30 AM, ulf johansson <epkuson at gmail.com> wrote:

> Hello,
> I would need some help with ffmpeg.
>
>
> Project:
> I'm trying to configure ffmpeg to provide live TV HLS streaming and
> transcoding to my Ipad in my home.
>
> Input:
> Video source: Hauppauge HD PVR(CBR) - analogue Component + OPTICAL => h264
> AAC mpegts
> CPU: quadcore when full transcoding is used~ 19-39-% load on all cores.
> (the lower bitrate => higher CPU load )
> OS: LInux Ubuntu
>
> I had to break down the streaming in two steps. (I had some problem with
> buffer handling, i.e. the HD PVR stopped streaming, when I performed
> transcoding directly from /dev/video0)
>
> 1.) Record input stream to file and store the file in a mpeg TS file.
> $ /usr/local/bin/ffmpeg -i /dev/video0 -vcodec copy -acodec copy -y
> ~/repository/recorded_stream.ts
>
>
> Approx. 10s delay until starting transcoding process on 'ts' file.
>
> 2.)Transcode 'ts' and stream using HLS of live TV to IPAD.
> $/usr/local/bin/ffmpeg -re -i ~/repository/recorded_stream.ts  -vcodec
> libx264 -b:v 2000k -acodec copy -s 1024x768 -aspect 4:3 -flags
> -global_header -map 0 -f segment -segment_time 10 -segment_list test.m3u8
> -segment_list_flags live -segment_list_size 0 -y -segment_format mpegts
>  stream%05d.ts
>
> Problem Description:
> ===============
> When performing transcoding and using bitrate of approx > 1.2 M (b:v
> 1000k), the live streaming to the IPAD starves after approximately a few
> minutes when new segments are not produced quick enough, i.e. playing the
> segments catches up with the available segments from the playlist even if
> the player is not started until 3-4 segments are available in playlist. The
> QOE result in a short stalls of the live video, and can be reduced by using
> pause for a while , but will eventually catch up again and the stalls
> resumes.
>
> When the higher bitrate is selected the transcoding FPS goes down 25-27,
> which I believe could be the reason for starving the client. TV signal is
> NTSC 1080i 59.94 interlaced, or 29.97 FPS, so I would expect the FPS output
> to also be 30 FPS for the live transcoded HLS segments.
> When I use 1M bitrate an output of 30 FPS is achieved and I don't
> experience the starving of file segments.
>
> The same problem can be re-produced with using VLC for viewing the HLS
> stream.
>
> I've tried to use forced FPS '-r 30' or '-r 29.97' on the transcoding
> process but it seems to have no affect when higher bitrates are used. E.g.
> if I set it to -r 32 it will only take affect if bitrate is < 1M.
>
> Would truly appreciate some help to solve the starving file segments since
> is significantly impacts the QOE for the end user.
>
> ============================
> 1) Recording file
>
> $ /usr/local/bin/ffmpeg -i /dev/video0 -vcodec copy -acodec copy -y
> ~/repository/recorded_stream.ts
> ffmpeg version git-2013-04-10-2383068 Copyright (c) 2000-2013 the FFmpeg
> developers
>   built on Apr 10 2013 00:29:02 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
>   configuration: --enable-gpl --enable-libass --enable-libfaac
> --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
> --enable-libopencore-amrwb --enable-libspeex --enable-librtmp
> --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab
> --enable-libx264 --enable-nonfree --enable-version3
>   libavutil      52. 25.100 / 52. 25.100
>   libavcodec     55.  2.100 / 55.  2.100
>   libavformat    55.  1.100 / 55.  1.100
>   libavdevice    55.  0.100 / 55.  0.100
>   libavfilter     3. 50.100 /  3. 50.100
>   libswscale      2.  2.100 /  2.  2.100
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  2.100 / 52.  2.100
> [mpegts @ 0x29eefc0] max_analyze_duration 5000000 reached at 5013333
> microseconds
> Input #0, mpegts, from '/dev/video0':
>   Duration: N/A, start: 0.387044, bitrate: 130 kb/s
>   Program 1
>     Stream #0:0[0x1011]: Video: h264 (Main) (HDMV / 0x564D4448), yuv420p,
> 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
>     Stream #0:1[0x1100]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz,
> stereo, fltp, 130 kb/s
> Output #0, mpegts, to '/home/jocho/repository/recorded_stream.ts':
>   Metadata:
>     encoder         : Lavf55.1.100
>     Stream #0:0: Video: h264 (HDMV / 0x564D4448), yuv420p, 1920x1080 [SAR
> 1:1 DAR 16:9], q=2-31, 29.97 fps, 90k tbn, 29.97 tbc
>     Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo,
> 130 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
>   Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> frame=10219 fps= 62 q=-1.0 Lsize=  150029kB time=00:02:50.53
> bitrate=7206.8kbits/s
> video:135224kB audio:2719kB subtitle:0 global headers:0kB muxing overhead
> 8.760707%
> $
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
> 2.1) bitrate 1M, "no starve", no -r, FPS stats => 30 FPS (below 29FPS
> which was the last stat output)
>
> $ /usr/local/bin/ffmpeg -re -i ~/repository/recorded_stream.ts -vcodec
> libx264 -b:v 1000k -acodec copy -s 1024x768 -aspect 4:3 -flags
> -global_header -map 0 -f segment -segment_time 10 -segment_list test.m3u8
> -segment_list_flags live -segment_list_size 0 -y -segment_format mpegts
>  stream%05d.ts
> ffmpeg version git-2013-04-10-2383068 Copyright (c) 2000-2013 the FFmpeg
> developers
>   built on Apr 10 2013 00:29:02 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
>   configuration: --enable-gpl --enable-libass --enable-libfaac
> --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
> --enable-libopencore-amrwb --enable-libspeex --enable-librtmp
> --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab
> --enable-libx264 --enable-nonfree --enable-version3
>   libavutil      52. 25.100 / 52. 25.100
>   libavcodec     55.  2.100 / 55.  2.100
>   libavformat    55.  1.100 / 55.  1.100
>   libavdevice    55.  0.100 / 55.  0.100
>   libavfilter     3. 50.100 /  3. 50.100
>   libswscale      2.  2.100 /  2.  2.100
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  2.100 / 52.  2.100
> [mpegts @ 0x2c4e760] max_analyze_duration 5000000 reached at 5003333
> microseconds
> Input #0, mpegts, from '/home/jocho/repository/recorded_stream.ts':
>   Duration: 00:02:50.60, start: 1.400000, bitrate: 7204 kb/s
>   Program 1
>     Metadata:
>       service_name    : Service01
>       service_provider: FFmpeg
>     Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
> yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94
> tbc
>     Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz,
> stereo, fltp, 118 kb/s
> [libx264 @ 0x2c549a0] using SAR=1/1
> [libx264 @ 0x2c549a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1
> Cache64
> [libx264 @ 0x2c549a0] profile High, level 3.1
> [segment @ 0x2c53f00] Codec for stream 0 does not use global headers but
> container format requires global headers
> [segment @ 0x2c53f00] Codec for stream 1 does not use global headers but
> container format requires global headers
> Output #0, segment, to 'stream%05d.ts':
>   Metadata:
>     encoder         : Lavf55.1.100
>     Stream #0:0: Video: h264, yuv420p, 1024x768 [SAR 1:1 DAR 4:3],
> q=-1--1, 1000 kb/s, 90k tbn, 29.97 tbc
>     Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo,
> 118 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 -> libx264)
>   Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> frame= 1105 fps= 29 q=32766.0 Lsize=N/A time=00:00:36.84 bitrate=N/A dup=1
> drop=0
> video:4368kB audio:588kB subtitle:0 global headers:0kB muxing overhead
> -100.000434%
> [libx264 @ 0x2c549a0] frame I:22    Avg QP:20.97  size: 18575
> [libx264 @ 0x2c549a0] frame P:474   Avg QP:22.31  size:  6433
> [libx264 @ 0x2c549a0] frame B:609   Avg QP:23.91  size:  1666
> [libx264 @ 0x2c549a0] consecutive B-frames: 14.7% 27.3% 24.7% 33.3%
> [libx264 @ 0x2c549a0] mb I  I16..4: 41.2% 50.9%  8.0%
> [libx264 @ 0x2c549a0] mb P  I16..4:  6.8%  6.8%  0.6%  P16..4: 30.3%  5.2%
>  3.1%  0.0%  0.0%    skip:47.2%
> [libx264 @ 0x2c549a0] mb B  I16..4:  0.3%  0.3%  0.0%  B16..8: 23.2%  0.9%
>  0.2%  direct: 1.0%  skip:74.2%  L0:36.7% L1:61.4% BI: 1.9%
> [libx264 @ 0x2c549a0] final ratefactor: 22.56
> [libx264 @ 0x2c549a0] 8x8 transform intra:48.6% inter:91.1%
> [libx264 @ 0x2c549a0] coded y,uvDC,uvAC intra: 30.9% 34.7% 7.6% inter:
> 6.1% 9.0% 0.3%
> [libx264 @ 0x2c549a0] i16 v,h,dc,p: 36% 36%  4% 24%
> [libx264 @ 0x2c549a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 19% 25%  3%  5%
>  6%  5%  5%  4%
> [libx264 @ 0x2c549a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 32% 11%  3%  5%
>  6%  4%  4%  2%
> [libx264 @ 0x2c549a0] i8c dc,h,v,p: 65% 18% 14%  3%
> [libx264 @ 0x2c549a0] Weighted P-Frames: Y:1.9% UV:0.4%
> [libx264 @ 0x2c549a0] ref P L0: 66.4%  8.2% 18.6%  6.8%  0.0%
> [libx264 @ 0x2c549a0] ref B L0: 81.7% 16.0%  2.3%
> [libx264 @ 0x2c549a0] ref B L1: 94.4%  5.6%
> [libx264 @ 0x2c549a0] kb/s:970.43
>
>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
>
> 2.2) bitrate 2M, "starve", no -r, FPS stats => 26-28 FPS (below 27FPS
> which was the last stat output, but alternating 26-28 throughout the
> trasnscoding)
>
>
> $ /usr/local/bin/ffmpeg -re -i ~/repository/recorded_stream.ts -vcodec
> libx264 -b:v 2000k -acodec copy -s 1024x768 -aspect 4:3 -flags
> -global_header -map 0 -f segment -segment_time 10 -segment_list test.m3u8
> -segment_list_flags live -segment_list_size 0 -y -segment_format mpegts
>  stream%05d.ts
> ffmpeg version git-2013-04-10-2383068 Copyright (c) 2000-2013 the FFmpeg
> developers
>   built on Apr 10 2013 00:29:02 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
>   configuration: --enable-gpl --enable-libass --enable-libfaac
> --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
> --enable-libopencore-amrwb --enable-libspeex --enable-librtmp
> --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab
> --enable-libx264 --enable-nonfree --enable-version3
>   libavutil      52. 25.100 / 52. 25.100
>   libavcodec     55.  2.100 / 55.  2.100
>   libavformat    55.  1.100 / 55.  1.100
>   libavdevice    55.  0.100 / 55.  0.100
>   libavfilter     3. 50.100 /  3. 50.100
>   libswscale      2.  2.100 /  2.  2.100
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  2.100 / 52.  2.100
> [mpegts @ 0x1cb5760] max_analyze_duration 5000000 reached at 5003333
> microseconds
> Input #0, mpegts, from '/home/jocho/repository/recorded_stream.ts':
>   Duration: 00:02:50.60, start: 1.400000, bitrate: 7204 kb/s
>   Program 1
>     Metadata:
>       service_name    : Service01
>       service_provider: FFmpeg
>     Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
> yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94
> tbc
>     Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz,
> stereo, fltp, 118 kb/s
> [libx264 @ 0x1cbb9a0] using SAR=1/1
> [libx264 @ 0x1cbb9a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1
> Cache64
> [libx264 @ 0x1cbb9a0] profile High, level 3.1
> [segment @ 0x1cbaf00] Codec for stream 0 does not use global headers but
> container format requires global headers
> [segment @ 0x1cbaf00] Codec for stream 1 does not use global headers but
> container format requires global headers
> Output #0, segment, to 'stream%05d.ts':
>   Metadata:
>     encoder         : Lavf55.1.100
>     Stream #0:0: Video: h264, yuv420p, 1024x768 [SAR 1:1 DAR 4:3],
> q=-1--1, 2000 kb/s, 90k tbn, 29.97 tbc
>     Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo,
> 118 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 -> libx264)
>   Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> frame=  649 fps= 27 q=32766.0 Lsize=N/A time=00:00:21.71 bitrate=N/A dup=1
> drop=0
> video:5349kB audio:346kB subtitle:0 global headers:0kB muxing overhead
> -100.000377%
> [libx264 @ 0x1cbb9a0] frame I:15    Avg QP:17.04  size: 27166
> [libx264 @ 0x1cbb9a0] frame P:301   Avg QP:18.57  size: 12511
> [libx264 @ 0x1cbb9a0] frame B:333   Avg QP:20.28  size:  3916
> [libx264 @ 0x1cbb9a0] consecutive B-frames: 18.2% 30.8% 28.2% 22.8%
> [libx264 @ 0x1cbb9a0] mb I  I16..4: 31.2% 53.9% 15.0%
> [libx264 @ 0x1cbb9a0] mb P  I16..4:  6.9% 10.2%  1.7%  P16..4: 36.1% 11.1%
>  5.2%  0.0%  0.0%    skip:28.7%
> [libx264 @ 0x1cbb9a0] mb B  I16..4:  0.6%  0.4%  0.1%  B16..8: 31.3%  2.9%
>  0.5%  direct: 2.6%  skip:61.6%  L0:37.8% L1:57.2% BI: 5.1%
> [libx264 @ 0x1cbb9a0] final ratefactor: 18.84
> [libx264 @ 0x1cbb9a0] 8x8 transform intra:53.4% inter:86.7%
> [libx264 @ 0x1cbb9a0] coded y,uvDC,uvAC intra: 44.7% 47.5% 18.7% inter:
> 13.8% 13.3% 1.2%
> [libx264 @ 0x1cbb9a0] i16 v,h,dc,p: 29% 35%  4% 31%
> [libx264 @ 0x1cbb9a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 22% 19%  3%  5%
>  6%  5%  5%  4%
> [libx264 @ 0x1cbb9a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 35% 12%  2%  4%
>  4%  3%  3%  2%
> [libx264 @ 0x1cbb9a0] i8c dc,h,v,p: 59% 20% 17%  3%
> [libx264 @ 0x1cbb9a0] Weighted P-Frames: Y:2.7% UV:0.7%
> [libx264 @ 0x1cbb9a0] ref P L0: 65.2%  7.0% 20.1%  7.6%  0.1%
> [libx264 @ 0x1cbb9a0] ref B L0: 79.6% 18.4%  1.9%
> [libx264 @ 0x1cbb9a0] ref B L1: 93.8%  6.2%
> [libx264 @ 0x1cbb9a0] kb/s:2023.47
>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
>
> 2.3) bitrate 4M, "starve", no -r, FPS stats => 22-24 FPS (below 21FPS
> which was the last stat output, but alternating 21-24 throughout the
> transcoding)
>
> $ /usr/local/bin/ffmpeg -re -i ~/repository/recorded_stream.ts -vcodec
> libx264 -b:v 4000k -acodec copy -s 1024x768 -aspect 4:3 -flags
> -global_header -map 0 -f segment -segment_time 10 -segment_list test.m3u8
> -segment_list_flags live -segment_list_size 0 -y -segment_format mpegts
>  stream%05d.ts
> ffmpeg version git-2013-04-10-2383068 Copyright (c) 2000-2013 the FFmpeg
> developers
>   built on Apr 10 2013 00:29:02 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
>   configuration: --enable-gpl --enable-libass --enable-libfaac
> --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
> --enable-libopencore-amrwb --enable-libspeex --enable-librtmp
> --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab
> --enable-libx264 --enable-nonfree --enable-version3
>   libavutil      52. 25.100 / 52. 25.100
>   libavcodec     55.  2.100 / 55.  2.100
>   libavformat    55.  1.100 / 55.  1.100
>   libavdevice    55.  0.100 / 55.  0.100
>   libavfilter     3. 50.100 /  3. 50.100
>   libswscale      2.  2.100 /  2.  2.100
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  2.100 / 52.  2.100
> [mpegts @ 0x301a760] max_analyze_duration 5000000 reached at 5003333
> microseconds
> Input #0, mpegts, from '/home/jocho/repository/recorded_stream.ts':
>   Duration: 00:02:50.60, start: 1.400000, bitrate: 7204 kb/s
>   Program 1
>     Metadata:
>       service_name    : Service01
>       service_provider: FFmpeg
>     Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
> yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94
> tbc
>     Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz,
> stereo, fltp, 118 kb/s
> [libx264 @ 0x30209a0] using SAR=1/1
> [libx264 @ 0x30209a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1
> Cache64
> [libx264 @ 0x30209a0] profile High, level 3.1
> [segment @ 0x301ff00] Codec for stream 0 does not use global headers but
> container format requires global headers
> [segment @ 0x301ff00] Codec for stream 1 does not use global headers but
> container format requires global headers
> Output #0, segment, to 'stream%05d.ts':
>   Metadata:
>     encoder         : Lavf55.1.100
>     Stream #0:0: Video: h264, yuv420p, 1024x768 [SAR 1:1 DAR 4:3],
> q=-1--1, 4000 kb/s, 90k tbn, 29.97 tbc
>     Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo,
> 118 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 -> libx264)
>   Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> frame=  484 fps= 21 q=32766.0 Lsize=N/A time=00:00:16.10 bitrate=N/A dup=1
> drop=0
> video:8041kB audio:257kB subtitle:0 global headers:0kB muxing overhead
> -100.000259%
> [libx264 @ 0x30209a0] frame I:10    Avg QP:12.15  size: 45657
> [libx264 @ 0x30209a0] frame P:231   Avg QP:13.81  size: 24621
> [libx264 @ 0x30209a0] frame B:243   Avg QP:15.47  size:  8599
> [libx264 @ 0x30209a0] consecutive B-frames: 18.8% 33.1% 29.1% 19.0%
> [libx264 @ 0x30209a0] mb I  I16..4: 24.8% 58.3% 16.9%
> [libx264 @ 0x30209a0] mb P  I16..4:  6.2% 15.3%  3.5%  P16..4: 31.4% 19.2%
>  9.5%  0.0%  0.0%    skip:14.9%
> [libx264 @ 0x30209a0] mb B  I16..4:  0.8%  0.7%  0.2%  B16..8: 32.3%  9.2%
>  2.2%  direct: 7.5%  skip:47.2%  L0:39.1% L1:49.7% BI:11.3%
> [libx264 @ 0x30209a0] final ratefactor: 14.08
> [libx264 @ 0x30209a0] 8x8 transform intra:59.8% inter:71.0%
> [libx264 @ 0x30209a0] coded y,uvDC,uvAC intra: 65.1% 63.2% 43.7% inter:
> 26.2% 18.8% 3.4%
> [libx264 @ 0x30209a0] i16 v,h,dc,p: 26% 30%  5% 39%
> [libx264 @ 0x30209a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 23% 18%  3%  4%
>  6%  4%  5%  4%
> [libx264 @ 0x30209a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 33% 12%  2%  4%
>  4%  3%  3%  2%
> [libx264 @ 0x30209a0] i8c dc,h,v,p: 56% 20% 19%  4%
> [libx264 @ 0x30209a0] Weighted P-Frames: Y:2.6% UV:0.9%
> [libx264 @ 0x30209a0] ref P L0: 65.6%  5.7% 20.9%  7.7%  0.1%
> [libx264 @ 0x30209a0] ref B L0: 80.2% 18.3%  1.5%
> [libx264 @ 0x30209a0] ref B L1: 93.7%  6.3%
> [libx264 @ 0x30209a0] kb/s:4078.74
>
>
>
>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
>
> 2.4) bitrate 2M, "starve", -r 30 , FPS stats => 26-28 FPS (below 28FPS
> which was the last stat output, but alternating 26-28 throughout the
> transcoding)
> OBS, same result as 2.2 without -r 30
>
>
> $ /usr/local/bin/ffmpeg -re -i ~/repository/recorded_stream.ts -r 30
> -vcodec libx264 -b:v 2000k -acodec copy -s 1024x768 -aspect 4:3 -flags
> -global_header -map 0 -f segment -segment_time 10 -segment_list test.m3u8
> -segment_list_flags live -segment_list_size 0 -y -segment_format mpegts
>  stream%05d.ts
> ffmpeg version git-2013-04-10-2383068 Copyright (c) 2000-2013 the FFmpeg
> developers
>   built on Apr 10 2013 00:29:02 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
>   configuration: --enable-gpl --enable-libass --enable-libfaac
> --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
> --enable-libopencore-amrwb --enable-libspeex --enable-librtmp
> --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab
> --enable-libx264 --enable-nonfree --enable-version3
>   libavutil      52. 25.100 / 52. 25.100
>   libavcodec     55.  2.100 / 55.  2.100
>   libavformat    55.  1.100 / 55.  1.100
>   libavdevice    55.  0.100 / 55.  0.100
>   libavfilter     3. 50.100 /  3. 50.100
>   libswscale      2.  2.100 /  2.  2.100
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  2.100 / 52.  2.100
> [mpegts @ 0x37db780] max_analyze_duration 5000000 reached at 5003333
> microseconds
> Input #0, mpegts, from '/home/jocho/repository/recorded_stream.ts':
>   Duration: 00:02:50.60, start: 1.400000, bitrate: 7204 kb/s
>   Program 1
>     Metadata:
>       service_name    : Service01
>       service_provider: FFmpeg
>     Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
> yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94
> tbc
>     Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz,
> stereo, fltp, 118 kb/s
> [libx264 @ 0x37e1d20] using SAR=1/1
> [libx264 @ 0x37e1d20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1
> Cache64
> [libx264 @ 0x37e1d20] profile High, level 3.1
> [segment @ 0x37e1060] Codec for stream 0 does not use global headers but
> container format requires global headers
> [segment @ 0x37e1060] Codec for stream 1 does not use global headers but
> container format requires global headers
> Output #0, segment, to 'stream%05d.ts':
>   Metadata:
>     encoder         : Lavf55.1.100
>     Stream #0:0: Video: h264, yuv420p, 1024x768 [SAR 1:1 DAR 4:3],
> q=-1--1, 2000 kb/s, 90k tbn, 30 tbc
>     Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo,
> 118 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 -> libx264)
>   Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> frame=  851 fps= 28 q=32766.0 Lsize=N/A time=00:00:28.30 bitrate=N/A dup=2
> drop=0
> video:6738kB audio:451kB subtitle:0 global headers:0kB muxing overhead
> -100.000299%
> [libx264 @ 0x37e1d20] frame I:18    Avg QP:16.76  size: 30818
> [libx264 @ 0x37e1d20] frame P:370   Avg QP:18.19  size: 12310
> [libx264 @ 0x37e1d20] frame B:463   Avg QP:19.80  size:  3867
> [libx264 @ 0x37e1d20] consecutive B-frames: 15.5% 27.0% 26.4% 31.0%
> [libx264 @ 0x37e1d20] mb I  I16..4: 28.9% 55.1% 16.0%
> [libx264 @ 0x37e1d20] mb P  I16..4:  6.6%  9.3%  1.6%  P16..4: 36.1% 11.1%
>  5.5%  0.0%  0.0%    skip:29.9%
> [libx264 @ 0x37e1d20] mb B  I16..4:  0.6%  0.5%  0.1%  B16..8: 30.8%  2.7%
>  0.5%  direct: 2.7%  skip:62.2%  L0:38.6% L1:56.9% BI: 4.5%
> [libx264 @ 0x37e1d20] final ratefactor: 18.40
> [libx264 @ 0x37e1d20] 8x8 transform intra:53.0% inter:86.6%
> [libx264 @ 0x37e1d20] coded y,uvDC,uvAC intra: 44.7% 48.5% 20.8% inter:
> 13.2% 13.7% 1.3%
> [libx264 @ 0x37e1d20] i16 v,h,dc,p: 31% 36%  5% 28%
> [libx264 @ 0x37e1d20] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 22% 20%  3%  5%
>  6%  5%  5%  4%
> [libx264 @ 0x37e1d20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 34% 13%  3%  4%
>  4%  4%  3%  2%
> [libx264 @ 0x37e1d20] i8c dc,h,v,p: 59% 20% 18%  3%
> [libx264 @ 0x37e1d20] Weighted P-Frames: Y:2.2% UV:0.5%
> [libx264 @ 0x37e1d20] ref P L0: 65.1%  6.6% 20.4%  7.8%  0.0%
> [libx264 @ 0x37e1d20] ref B L0: 79.4% 18.3%  2.3%
> [libx264 @ 0x37e1d20] ref B L1: 93.2%  6.8%
> [libx264 @ 0x37e1d20] kb/s:1946.00
>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
>
> 2.5) bitrate 512k, "no starve", -r 32 , FPS stats => 32 FPS (below 31 FPS
> which was the last stat output, but after initially a few around 29, it
> stabilized to 32 fairly quickly.
>
> It shows that FPS can be forced.
>
>
> $ /usr/local/bin/ffmpeg -re -i ~/repository/recorded_stream.ts -r 32
> -vcodec libx264 -b:v 512k -acodec copy -s 1024x768 -aspect 4:3 -flags
> -global_header -map 0 -f segment -segment_time 10 -segment_list test.m3u8
> -segment_list_flags live -segment_list_size 0 -y -segment_format mpegts
>  stream%05d.ts
> ffmpeg version git-2013-04-10-2383068 Copyright (c) 2000-2013 the FFmpeg
> developers
>   built on Apr 10 2013 00:29:02 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
>   configuration: --enable-gpl --enable-libass --enable-libfaac
> --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
> --enable-libopencore-amrwb --enable-libspeex --enable-librtmp
> --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab
> --enable-libx264 --enable-nonfree --enable-version3
>   libavutil      52. 25.100 / 52. 25.100
>   libavcodec     55.  2.100 / 55.  2.100
>   libavformat    55.  1.100 / 55.  1.100
>   libavdevice    55.  0.100 / 55.  0.100
>   libavfilter     3. 50.100 /  3. 50.100
>   libswscale      2.  2.100 /  2.  2.100
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  2.100 / 52.  2.100
> [mpegts @ 0x1dda780] max_analyze_duration 5000000 reached at 5003333
> microseconds
> Input #0, mpegts, from '/home/jocho/repository/recorded_stream.ts':
>   Duration: 00:02:50.60, start: 1.400000, bitrate: 7204 kb/s
>   Program 1
>     Metadata:
>       service_name    : Service01
>       service_provider: FFmpeg
>     Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
> yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94
> tbc
>     Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz,
> stereo, fltp, 118 kb/s
> [libx264 @ 0x1de0d20] using SAR=1/1
> [libx264 @ 0x1de0d20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1
> Cache64
> [libx264 @ 0x1de0d20] profile High, level 3.1
> [segment @ 0x1de0060] Codec for stream 0 does not use global headers but
> container format requires global headers
> [segment @ 0x1de0060] Codec for stream 1 does not use global headers but
> container format requires global headers
> Output #0, segment, to 'stream%05d.ts':
>   Metadata:
>     encoder         : Lavf55.1.100
>     Stream #0:0: Video: h264, yuv420p, 1024x768 [SAR 1:1 DAR 4:3],
> q=-1--1, 512 kb/s, 90k tbn, 32 tbc
>     Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo,
> 118 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 -> libx264)
>   Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> frame=  914 fps= 31 q=32766.0 Lsize=N/A time=00:00:28.60 bitrate=N/A
> dup=59 drop=0
> video:1654kB audio:456kB subtitle:0 global headers:0kB muxing overhead
> -100.001018%
> [libx264 @ 0x1de0d20] frame I:18    Avg QP:27.26  size: 10046
> [libx264 @ 0x1de0d20] frame P:407   Avg QP:29.04  size:  2918
> [libx264 @ 0x1de0d20] frame B:489   Avg QP:31.59  size:   665
> [libx264 @ 0x1de0d20] consecutive B-frames: 18.2% 24.3% 21.7% 35.9%
> [libx264 @ 0x1de0d20] mb I  I16..4: 53.8% 42.9%  3.3%
> [libx264 @ 0x1de0d20] mb P  I16..4:  7.1%  4.7%  0.3%  P16..4: 18.2%  2.0%
>  0.8%  0.0%  0.0%    skip:66.8%
> [libx264 @ 0x1de0d20] mb B  I16..4:  0.1%  0.2%  0.0%  B16..8: 13.5%  0.4%
>  0.1%  direct: 0.2%  skip:85.5%  L0:30.1% L1:68.9% BI: 1.1%
> [libx264 @ 0x1de0d20] final ratefactor: 28.13
> [libx264 @ 0x1de0d20] 8x8 transform intra:40.7% inter:92.4%
> [libx264 @ 0x1de0d20] coded y,uvDC,uvAC intra: 19.6% 19.0% 1.5% inter:
> 2.0% 1.9% 0.0%
> [libx264 @ 0x1de0d20] i16 v,h,dc,p: 43% 33%  5% 19%
> [libx264 @ 0x1de0d20] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 18% 26%  3%  4%
>  5%  4%  5%  3%
> [libx264 @ 0x1de0d20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 27% 11%  3%  4%
>  6%  4%  5%  2%
> [libx264 @ 0x1de0d20] i8c dc,h,v,p: 80% 11%  9%  1%
> [libx264 @ 0x1de0d20] Weighted P-Frames: Y:2.0% UV:0.5%
> [libx264 @ 0x1de0d20] ref P L0: 66.6% 11.2% 16.4%  5.8%  0.0%
> [libx264 @ 0x1de0d20] ref B L0: 85.0% 12.6%  2.4%
> [libx264 @ 0x1de0d20] ref B L1: 96.2%  3.8%
> [libx264 @ 0x1de0d20] kb/s:474.38
>
> !!!!!!!
>
> Would truly appreciate some help to solve the starving file segments since
> is significantly impacts the QOE for the end user.
> best regard
> uffe
>
>


More information about the ffmpeg-user mailing list