[Libav-user] Encoding to MPEG2 buffer sizing

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Libav-user] Encoding to MPEG2 buffer sizing

Jonathan Noble
Hello,

In my program I am continuously seeing the following 3 messages:

> [mpeg @ 0x7f33b8004200] buffer underflow st=1 bufi=379 size=1024

> [mpeg2video @ 0x7f33b8215280] reencoding frame due to VBV

> [mpeg2video @ 0x7f33b8215280] rc buffer underflow


I am encoding with a constant bitrate where AVCodecContext's bit_rate = rc_min_rate = rc_max_rate.


I have tried to change the size of rc_buffer_size but I see the following message


> [mpeg2video @ 0x7f33b8215280] Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!

> [mpeg @ 0x7f33b8004200] VBV buffer size not set, using default size of 230KB

If you want the mpeg file to be compliant to some specification

Like DVD, VCD or others, make sure you set the correct buffer size

> [mpeg @ 0x7f33b8004200] ac3 in MPEG-1 system streams is not widely supported, consider using the vob or the dvd muxer to force a MPEG-2 program stream.


How does one correctly configure the buffer for a given bitrate in MPEG2?


Kind regards


Jon Noble



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

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

Re: Encoding to MPEG2 buffer sizing

Carl Eugen Hoyos-2
Am Mi., 25. Sept. 2019 um 22:57 Uhr schrieb Jonathan Noble
<[hidden email]>:

> [mpeg @ 0x7f33b8004200] ac3 in MPEG-1 system streams is not widely supported,
> consider using the vob or the dvd muxer to force a MPEG-2 program stream.

Note that independently of your question (I suggest to test with the
cli), the output
file will be unplayable with most players as ac3 in mpeg-1 system streams are
typically unsupported (as written above).

Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

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

Re: Encoding to MPEG2 buffer sizing

Jonathan Noble
I have had a playaround with ffmpeg to get an understanding of what rc_buffer_size needs to be set to but that didn't provide much information.
Instead I stepped through ffmpeg and I can see that there are 2 buffers that need to be set up. 1 is in AVCodecContext, the other is in AVStream,

Setting AVCodecContext->rc_buffer_size seems to have to be done in units of KB. If i use bits as the unit I see this

> [mpeg2video @ 0x7f3a2c805600] Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!


As for setting the buffer in AVStream, I cannot see how it is done. mpegenc.c gets the buffer_size in a struct AVCPBProperties using a call to av_stream_get_side_data.

How does one set the values in AVCPBProperties in the AVStream?



On Wed, 25 Sep 2019 at 22:20, Carl Eugen Hoyos <[hidden email]> wrote:
Am Mi., 25. Sept. 2019 um 22:57 Uhr schrieb Jonathan Noble
<[hidden email]>:

> [mpeg @ 0x7f33b8004200] ac3 in MPEG-1 system streams is not widely supported,
> consider using the vob or the dvd muxer to force a MPEG-2 program stream.

Note that independently of your question (I suggest to test with the
cli), the output
file will be unplayable with most players as ac3 in mpeg-1 system streams are
typically unsupported (as written above).

Carl Eugen
______________________________
_________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

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

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

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