Francois Visagie <[email protected]> added the comment:

On Sun, May 24, 2009 at 2:18 PM, Baptiste Coudurier <
[email protected]> wrote:

Hi Baptiste,

> > I could find no description of what effects the ...dvd options have,
> which
> > is why to be safe I specify my own upper limits. Including -muxrate
> 10080000
> > to ensure total bitrate (including mux overhead even) remain within the
> > maximum total bitrate mentioned at http://en.wikipedia.org/wiki/Mpeg-2and
> > elsewhere.
>
> ffmpeg.c does:
>
>        opt_video_codec("mpeg2video");
>        opt_audio_codec("ac3");
>        opt_format("dvd");
>
>        opt_frame_size(norm ? "720x480" : "720x576");
>        opt_frame_rate(NULL, frame_rates[norm]);
>        opt_default("gop", norm ? "18" : "15");
>
>        opt_default("b", "6000000");
>        opt_default("maxrate", "9000000");
>        opt_default("minrate", "0"); //1500000;
>        opt_default("bufsize", "1835008"); //224*1024*8;
>
>        opt_default("packetsize", "2048");  // from www.mpucoder.com:
> DVD sectors contain 2048 bytes of data, this is also
>  the size of one pack.
>        opt_default("muxrate", "10080000"); // from mplex project:
> data_rate = 1260000. mux_rate = data_rate * 8
>
>        opt_default("ab", "448000");
>        audio_sample_rate = 48000;
>
> So adding -muxrate has no effect and is redundant.

This helps a lot to shed light on the issue for me!

> > When pal-dvd has been specified, what are its effects and what if any
> > additional options are required to ensure or improve DVD-Video
> compliance?
> > Or can you point me to comprehensive documentation on this?
>
> Unfortunately the source is the documentation, but help and patch is very
> welcome regarding this.

When I get around to assisting with this, I'll spend some time reading up
and enquring how best an unskilled and untooled person can contribute.

> What is your problem exactly ?
> Where does the file created using -target dvd has problem ?

The objective is to create a video+audio MPEG-2 encode which is
1) DVD-compliant and 2) leaves enough room for subtitle streams. The output
is demultiplexed into elementary video and audio streams and then
re-multiplexed (with 3 subtitle streams, menus and so on) into DVD structure
with MuxMan. I calculated the video bitrate for DVD-9 size. Making mistakes
or experimenting is very costly because the source is almost 3 hours long,
takes over 48 hours to encode, the machine doing the encoding is used at
work during the day and at home after hours and the source only fits onto an
external hard drive, so it requires incredible gymnastics to suspend and
resume the encode when moving the machine!

So I tried to design a command line that would achieve those objectives from
documentation. I had understood (quite likely incorrectly) from the MEncoder
documentation that its vrc_maxrate option specifies some nominal property in
the PS header for reference by the player, and that it wasn't really used in
actually enforcing maximum bitrate.

This and other incorrect assumptions and lacking knowledge are my problem.

I can see now from Michael's and your information that FFmpeg's maxrate at
least is very much involved in active rate control! It is also clear that
the maximum_video_bitrate + maximum_audio_bitrate + maximum_subtitle_bitrate
do not all fit into the maximum_total_bitrate of 10080000 bps!

For the dvd format, is the maxrate set for the duration of the encode, or
does FFmpeg dynamically adjust maxrate if it runs into trouble? If it does
adjust it, is it still governed by an ultimate upper limit of 9800000 for
dvd?

What would then be a useful and intelligent way of optimally managing
maxrate in its relationships with -b, -ab, muxrate within DVD format
constraints:

1. video bitrate itself may not become illegal,
2. video bitrate + audio bitrate (which is fixed in my case) may not exceed
the specified maximum legal muxrate,
3. a desired video bitrate average (in my case -b 6150000) is specified to
make maximum use of available space taking into account audio, subtitles,
muxing and DVD structure overhead and so on,
4. but of course having specified a desired average bitrate, one doesn't
want to specify maxrate so high that unnecessary space is wasted?

Thank you,
Francois

_____________________________________________________
FFmpeg issue tracker <[email protected]>
<https://roundup.ffmpeg.org/roundup/ffmpeg/issue1081>
_____________________________________________________
On Sun, May 24, 2009 at 2:18 PM, Baptiste Coudurier <[email protected]> wrote:
 
Hi Baptiste,
> I could find no description of what effects the ...dvd options have, which
> is why to be safe I specify my own upper limits. Including -muxrate 10080000
> to ensure total bitrate (including mux overhead even) remain within the
> maximum total bitrate mentioned at http://en.wikipedia.org/wiki/Mpeg-2 and
> elsewhere.

ffmpeg.c does:

       opt_video_codec("mpeg2video");
       opt_audio_codec("ac3");
       opt_format("dvd");

       opt_frame_size(norm ? "720x480" : "720x576");
       opt_frame_rate(NULL, frame_rates[norm]);
       opt_default("gop", norm ? "18" : "15");

       opt_default("b", "6000000");
       opt_default("maxrate", "9000000");
       opt_default("minrate", "0"); //1500000;
       opt_default("bufsize", "1835008"); //224*1024*8;

       opt_default("packetsize", "2048");  // from www.mpucoder.com:
DVD sectors contain 2048 bytes of data, this is also
 the size of one pack.
       opt_default("muxrate", "10080000"); // from mplex project:
data_rate = 1260000. mux_rate = data_rate * 8

       opt_default("ab", "448000");
       audio_sample_rate = 48000;

So adding -muxrate has no effect and is redundant.
 
This helps a lot to shed light on the issue for me!
 
> When pal-dvd has been specified, what are its effects and what if any
> additional options are required to ensure or improve DVD-Video compliance?
> Or can you point me to comprehensive documentation on this?

Unfortunately the source is the documentation, but help and patch is very
welcome regarding this.
 
When I get around to assisting with this, I'll spend some time reading up and enquring how best an unskilled and untooled person can contribute.
 
What is your problem exactly ?
Where does the file created using -target dvd has problem ?
 
The objective is to create a video+audio MPEG-2 encode which is 1) DVD-compliant and 2) leaves enough room for subtitle streams. The output is demultiplexed into elementary video and audio streams and then re-multiplexed (with 3 subtitle streams, menus and so on) into DVD structure with MuxMan. I calculated the video bitrate for DVD-9 size. Making mistakes or experimenting is very costly because the source is almost 3 hours long, takes over 48 hours to encode, the machine doing the encoding is used at work during the day and at home after hours and the source only fits onto an external hard drive, so it requires incredible gymnastics to suspend and resume the encode when moving the machine!
 
So I tried to design a command line that would achieve those objectives from documentation. I had understood (quite likely incorrectly) from the MEncoder documentation that its vrc_maxrate option specifies some nominal property in the PS header for reference by the player, and that it wasn't really used in actually enforcing maximum bitrate.
 
This and other incorrect assumptions and lacking knowledge are my problem.
 
I can see now from Michael's and your information that FFmpeg's maxrate at least is very much involved in active rate control! It is also clear that the maximum_video_bitrate + maximum_audio_bitrate + maximum_subtitle_bitrate do not all fit into the maximum_total_bitrate of 10080000 bps!
 
For the dvd format, is the maxrate set for the duration of the encode, or does FFmpeg dynamically adjust maxrate if it runs into trouble? If it does adjust it, is it still governed by an ultimate upper limit of 9800000 for dvd?
 
What would then be a useful and intelligent way of optimally managing maxrate in its relationships with -b, -ab, muxrate within DVD format constraints:
 
1. video bitrate itself may not become illegal,
2. video bitrate + audio bitrate (which is fixed in my case) may not exceed the specified maximum legal muxrate,
3. a desired video bitrate average (in my case -b 6150000) is specified to make maximum use of available space taking into account audio, subtitles, muxing and DVD structure overhead and so on,
4. but of course having specified a desired average bitrate, one doesn't want to specify maxrate so high that unnecessary space is wasted?
 
Thank you,
Francois

Reply via email to