[Libav-user] converting avi audio and video to dvd mpeg2 with ac3 audio

0xnullptr 0xnullptr at gmail.com
Mon Jul 21 17:34:59 CEST 2014


Hi,

Thankyou for replying. I'm new to libav* suite of libraries, as you can
probably tell.

Oh, how embarassing!
I am mistaken as I was looking though the source at so many parts. My
apologies.
Its the 'target' parameter option that I should be referring to in this
post.

I managed to follow the source code through the command line parsing up to 

[code]
} else if (!strcmp(arg, "dvd")) {
 opt_video_codec(o, "c:v", "mpeg2video");
 opt_audio_codec(o, "c:a", "ac3");
 parse_option(o, "f", "dvd", options);

 parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
 parse_option(o, "r", frame_rates[norm], options);
 parse_option(o, "pix_fmt", "yuv420p", options);
 av_dict_set(&o->g->codec_opts, "g", norm == PAL ? "15" : "18",
AV_DICT_DONT_OVERWRITE);

 av_dict_set(&o->g->codec_opts, "b:v", "6000000", AV_DICT_DONT_OVERWRITE);
 av_dict_set(&o->g->codec_opts, "maxrate", "9000000",
AV_DICT_DONT_OVERWRITE);
 av_dict_set(&o->g->codec_opts, "minrate", "0", AV_DICT_DONT_OVERWRITE); //
1500000;
 av_dict_set(&o->g->codec_opts, "bufsize", "1835008",
AV_DICT_DONT_OVERWRITE); // 224*1024*8;

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

 av_dict_set(&o->g->codec_opts, "b:a", "448000", AV_DICT_DONT_OVERWRITE);
 parse_option(o, "ar", "48000", options);
[/code]

and I think it's these parameters that I need to set via api calls from my
code? I don't quite understand the role of the AVDictionary and how it fits
into the library.

or is it really as simple as 'av_guess_format("dvd",NULL,NULL);'?
Are there resources available on the net so that I could learn the library
reasonably well?
Or do I need to roll up my sleeves and dive in to the source code and hope
that I don't drown?

So far I'm using AVCodec* to set the encoder to 'AV_CODEC_ID_MPEG2VIDEO',
AVCodecContext* to set the width,height,time_base( as AVRational {1,25}
),max_b_frames to 2.

As I'm new to libav I find that I'm a little in the dark as to the best
direction to take for self help and to  help learn to get to grips with the
correct parameters to set.

Sometimes I get the feeling that I'm getting in too deep with the parameters
and there are more appropriate settings that I can and should be using,
possible like the one you've suggested. 

Any pointers and help in the correct direction would be very much
appreciated.


Thankyou.

Dave.



--
View this message in context: http://libav-users.943685.n4.nabble.com/converting-avi-audio-and-video-to-dvd-mpeg2-with-ac3-audio-tp4660157p4660160.html
Sent from the libav-users mailing list archive at Nabble.com.


More information about the Libav-user mailing list