Question about CBR bit rate settings

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Question about CBR bit rate settings

Gil Yoder
According to Korbel in *FFmpeg Basics*, "To set the constant bit rate for
the output, three parameters must have the same value: bitrate (-b option),
minimal rate (-minrate) and maximal rate (-maxrate)" (p. 62). That makes
sense as far as it goes, but it is a bit unclear in my mind. It appears to
me that -minrate and -maxrate effect only the video output. Is that right?

 

If so, -b:v should be used instead of -b, along with -maxrate and -minrate
to set the CBR of the video stream if the output has both audio and video.
Is that correct?

 

In such, the total bit rate will be the sum of the -b:v and -b:a options
plus the demuxing overhead. Please, correct me if that's not right.

 

I ask because I'm trying to construct an argument to produce a low bitrate
live stream. So far I've come up with the following argument:

 

ffmpeg -hide_banner -f dshow -sample_rate 11025 -video_size qvga -i
video="HP Deluxe Webcam KQ246AA":audio="Microphone (Logitech USB Headset)"
-f flv -r 15 -c:v libx264 -crf 30 -preset veryfast -maxrate 96k -minrate 96k
-b:v 96k -bufsize 198k -pix_fmt yuv420p -g 30 -c:a aac -b:a 24k -metadata
copyright="Copyright 2017 OABS" -metadata artist="Gil Yoder"
"rtmp://***.****.***/live3/yoder?u=gil&e=1492253342&h=32628F7B51A3943A9D57FE
1B9D389328"

 

This is the output for a short session:

 

Guessed Channel Layout for Input Stream #0.1 : stereo

Input #0, dshow, from 'video=HP Deluxe Webcam KQ246AA:audio=Microphone
(Logitech USB Headset)':

  Duration: N/A, start: 342651.162000, bitrate: N/A

    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, 30
fps, 30 tbr, 10000k tbn, 10000k tbc

    Stream #0:1: Audio: pcm_s16le, 11025 Hz, stereo, s16, 352 kb/s

Stream mapping:

  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))

  Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))

Press [q] to stop, [?] for help

[libx264 @ 00000000025760a0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX

[libx264 @ 00000000025760a0] profile High, level 1.2

[libx264 @ 00000000025760a0] 264 - core 148 r2762 90a61ec - H.264/MPEG-4 AVC
codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options:
cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=7
lookahead_threads=1 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=1 keyint=30 keyint_min=3 scenecut=40
intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=30.0 qcomp=0.60 qpmin=0
qpmax=69 qpstep=4 vbv_maxrate=96 vbv_bufsize=198 crf_max=0.0 nal_hrd=none
filler=0 ip_ratio=1.40 aq=1:1.00

Output #0, flv, to
'rtmp://***.****.***/live3/yoder?u=gil&e=1492253342&h=32628F7B51A3943A9D57FE
1B9D389328':

  Metadata:

    copyright       : Copyright 2017 OABS

    artist          : Gil Yoder

    encoder         : Lavf57.67.100

    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007),
yuv420p(progressive), 320x240, q=-1--1, 96 kb/s, 15 fps, 1k tbn, 15 tbc

    Metadata:

      encoder         : Lavc57.86.103 libx264

    Side data:

      cpb: bitrate max/min/avg: 96000/0/96000 buffer size: 198000 vbv_delay:
-1

    Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 11025 Hz, stereo,
fltp, 24 kb/s

    Metadata:

      encoder         : Lavc57.86.103 aac

[flv @ 000000000259f240] Failed to update header with correct
duration.7.2kbits/s dup=0 drop=3 speed=1.02x

[flv @ 000000000259f240] Failed to update header with correct filesize.

frame=  936 fps=7.6 q=-1.0 Lsize=    1354kB time=00:02:04.86 bitrate=
88.8kbits/s dup=0 drop=3 speed=1.02x

video:949kB audio:363kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 3.117937%

[libx264 @ 00000000025760a0] frame I:32    Avg QP:25.15  size: 17474

[libx264 @ 00000000025760a0] frame P:253   Avg QP:30.90  size:  1266

[libx264 @ 00000000025760a0] frame B:651   Avg QP:35.10  size:   141

[libx264 @ 00000000025760a0] consecutive B-frames:  7.2%  0.2%  0.3% 92.3%

[libx264 @ 00000000025760a0] mb I  I16..4:  2.3%  5.2% 92.5%

[libx264 @ 00000000025760a0] mb P  I16..4:  0.3%  0.4%  0.3%  P16..4: 33.4%
9.0%  7.5%  0.0%  0.0%    skip:49.1%

[libx264 @ 00000000025760a0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  3.5%
1.7%  0.2%  direct: 3.8%  skip:90.7%  L0:27.9% L1:42.5% BI:29.6%

[libx264 @ 00000000025760a0] 8x8 transform intra:8.1% inter:14.6%

[libx264 @ 00000000025760a0] coded y,uvDC,uvAC intra: 92.4% 95.3% 88.1%
inter: 6.0% 6.4% 0.1%

[libx264 @ 00000000025760a0] i16 v,h,dc,p: 50% 20% 18% 13%

[libx264 @ 00000000025760a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 11% 23%  7%
6%  6%  5%  5%  7%

[libx264 @ 00000000025760a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 20% 10%  5%
7%  9%  6%  5%  8%

[libx264 @ 00000000025760a0] i8c dc,h,v,p: 42% 18% 30%  9%

[libx264 @ 00000000025760a0] Weighted P-Frames: Y:43.1% UV:34.8%

[libx264 @ 00000000025760a0] kb/s:62.44

[aac @ 00000000041a8900] Qavg: 645.025

 

The actual fps produced is less than desired, but the video doesn't look too
bad, and the audio sounds okay for voice. Is there a way to improve the A/V
without increasing bandwidth utilization?

 

Gil Yoder

 

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Question about CBR bit rate settings

rogerdpack2
I think you're right, the tutorial is probably outdated.

On 4/15/17, Gil Yoder <[hidden email]> wrote:

> According to Korbel in *FFmpeg Basics*, "To set the constant bit rate for
> the output, three parameters must have the same value: bitrate (-b option),
> minimal rate (-minrate) and maximal rate (-maxrate)" (p. 62). That makes
> sense as far as it goes, but it is a bit unclear in my mind. It appears to
> me that -minrate and -maxrate effect only the video output. Is that right?
>
>
>
> If so, -b:v should be used instead of -b, along with -maxrate and -minrate
> to set the CBR of the video stream if the output has both audio and video.
> Is that correct?
>
>
>
> In such, the total bit rate will be the sum of the -b:v and -b:a options
> plus the demuxing overhead. Please, correct me if that's not right.
>
>
>
> I ask because I'm trying to construct an argument to produce a low bitrate
> live stream. So far I've come up with the following argument:
>
>
>
> ffmpeg -hide_banner -f dshow -sample_rate 11025 -video_size qvga -i
> video="HP Deluxe Webcam KQ246AA":audio="Microphone (Logitech USB Headset)"
> -f flv -r 15 -c:v libx264 -crf 30 -preset veryfast -maxrate 96k -minrate 96k
> -b:v 96k -bufsize 198k -pix_fmt yuv420p -g 30 -c:a aac -b:a 24k -metadata
> copyright="Copyright 2017 OABS" -metadata artist="Gil Yoder"
> "rtmp://***.****.***/live3/yoder?u=gil&e=1492253342&h=32628F7B51A3943A9D57FE
> 1B9D389328"
>
>
>
> This is the output for a short session:
>
>
>
> Guessed Channel Layout for Input Stream #0.1 : stereo
>
> Input #0, dshow, from 'video=HP Deluxe Webcam KQ246AA:audio=Microphone
> (Logitech USB Headset)':
>
>   Duration: N/A, start: 342651.162000, bitrate: N/A
>
>     Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, 30
> fps, 30 tbr, 10000k tbn, 10000k tbc
>
>     Stream #0:1: Audio: pcm_s16le, 11025 Hz, stereo, s16, 352 kb/s
>
> Stream mapping:
>
>   Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
>
>   Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
>
> Press [q] to stop, [?] for help
>
> [libx264 @ 00000000025760a0] using cpu capabilities: MMX2 SSE2Fast SSSE3
> SSE4.2 AVX
>
> [libx264 @ 00000000025760a0] profile High, level 1.2
>
> [libx264 @ 00000000025760a0] 264 - core 148 r2762 90a61ec - H.264/MPEG-4 AVC
> codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options:
> cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1
> psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1
> cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=7
> lookahead_threads=1 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=1 keyint=30 keyint_min=3 scenecut=40
> intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=30.0 qcomp=0.60 qpmin=0
> qpmax=69 qpstep=4 vbv_maxrate=96 vbv_bufsize=198 crf_max=0.0 nal_hrd=none
> filler=0 ip_ratio=1.40 aq=1:1.00
>
> Output #0, flv, to
> 'rtmp://***.****.***/live3/yoder?u=gil&e=1492253342&h=32628F7B51A3943A9D57FE
> 1B9D389328':
>
>   Metadata:
>
>     copyright       : Copyright 2017 OABS
>
>     artist          : Gil Yoder
>
>     encoder         : Lavf57.67.100
>
>     Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007),
> yuv420p(progressive), 320x240, q=-1--1, 96 kb/s, 15 fps, 1k tbn, 15 tbc
>
>     Metadata:
>
>       encoder         : Lavc57.86.103 libx264
>
>     Side data:
>
>       cpb: bitrate max/min/avg: 96000/0/96000 buffer size: 198000 vbv_delay:
> -1
>
>     Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 11025 Hz, stereo,
> fltp, 24 kb/s
>
>     Metadata:
>
>       encoder         : Lavc57.86.103 aac
>
> [flv @ 000000000259f240] Failed to update header with correct
> duration.7.2kbits/s dup=0 drop=3 speed=1.02x
>
> [flv @ 000000000259f240] Failed to update header with correct filesize.
>
> frame=  936 fps=7.6 q=-1.0 Lsize=    1354kB time=00:02:04.86 bitrate=
> 88.8kbits/s dup=0 drop=3 speed=1.02x
>
> video:949kB audio:363kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 3.117937%
>
> [libx264 @ 00000000025760a0] frame I:32    Avg QP:25.15  size: 17474
>
> [libx264 @ 00000000025760a0] frame P:253   Avg QP:30.90  size:  1266
>
> [libx264 @ 00000000025760a0] frame B:651   Avg QP:35.10  size:   141
>
> [libx264 @ 00000000025760a0] consecutive B-frames:  7.2%  0.2%  0.3% 92.3%
>
> [libx264 @ 00000000025760a0] mb I  I16..4:  2.3%  5.2% 92.5%
>
> [libx264 @ 00000000025760a0] mb P  I16..4:  0.3%  0.4%  0.3%  P16..4: 33.4%
> 9.0%  7.5%  0.0%  0.0%    skip:49.1%
>
> [libx264 @ 00000000025760a0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  3.5%
> 1.7%  0.2%  direct: 3.8%  skip:90.7%  L0:27.9% L1:42.5% BI:29.6%
>
> [libx264 @ 00000000025760a0] 8x8 transform intra:8.1% inter:14.6%
>
> [libx264 @ 00000000025760a0] coded y,uvDC,uvAC intra: 92.4% 95.3% 88.1%
> inter: 6.0% 6.4% 0.1%
>
> [libx264 @ 00000000025760a0] i16 v,h,dc,p: 50% 20% 18% 13%
>
> [libx264 @ 00000000025760a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 11% 23%  7%
> 6%  6%  5%  5%  7%
>
> [libx264 @ 00000000025760a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 20% 10%  5%
> 7%  9%  6%  5%  8%
>
> [libx264 @ 00000000025760a0] i8c dc,h,v,p: 42% 18% 30%  9%
>
> [libx264 @ 00000000025760a0] Weighted P-Frames: Y:43.1% UV:34.8%
>
> [libx264 @ 00000000025760a0] kb/s:62.44
>
> [aac @ 00000000041a8900] Qavg: 645.025
>
>
>
> The actual fps produced is less than desired, but the video doesn't look too
> bad, and the audio sounds okay for voice. Is there a way to improve the A/V
> without increasing bandwidth utilization?
>
>
>
> Gil Yoder
>
>
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Loading...