On Wed, Mar 15, 2006 at 04:35:02PM +1030, Jonathan Woithe wrote: > Hi Nicolas > > > I use mpeg2enc to convert an YUV4MPEG stream to a mpeg2 file. That's to > > build a DVD. It works, but for CBR only. > > What happened when you tried to do VBR? What did you try? > > > I would like to know if anyone on this list got a (working) script > > converting an output file generated by cinelerra to a VBR mpeg2 file > > (with AC3 if possible). > > I no longer use an intermediate .mov file to do this - since Cinelerra 2.0 > (and CVS somewhat earlier), Cinelerra has been able to output data to a pipe > in the format expected my mpeg2enc. So now I just pipe directly into > mpeg2enc (which gives better quality and ends up being faster in my > particular workflow. This doesn't affect the mpeg2enc command line options > though - it just changes the way you get the data into mpeg2enc. To read > from a .mov file you utilise lav2yuv. > > So, if I was making a DVD from a .mov file I'd use something like this: > > lav2yuv foobar.mov | mpeg2enc -f 8 -q 4 -b 7500 -s -c -N 1.0 -E -10 > -o foobar.m2v > > (all on one line) This does the video component. The options are explained > in the mpeg2enc manpage. The important one here is "-q" - it sets the > quality factor used in the encoding and implies VBR. The "-b" option sets > the bitrate ceiling - the quality factor will be increased if necessary to > ensure this bitrate target is not exceeded. 7500 is conservative - with 320 > kbps MP2 audio for example you should be able to go as high as 8500 without > problems, so long as the resulting stream is still small enough to fit on > your DVD. Note that the *total* bitrate (audio, video, mux-overheard) must > be kept below 10100 kbps to keep standalone DVD players happy. > > As for audio, up to now I've used mp2 audio for various reasons, which I've > encoded using toolame. AAC should be the same except of course you use a > different encoder. > > At this point you have your video and audio streams. Multiplex them > using something like > > mplex -f 8 -V foobar.m2v foobar.m2a -o foobar.mpg > > (foobar.m2a being the encoded audio file) and you should end up with a nice > mpeg file called foobar.mpg which can then be used with dvdauthor to produce > your DVD image. "-V" tells mplex that it's dealing with a VBR stream. > > Finally, note this is all from memory - excuse any silly typos which might > have crept in. > > Regards > jonathan
Jonathan, In fact, I already used mpeg2enc to encode an yuv4mpeg stream. My script is : /usr/bin/yuvcorrect -T INTERLACED_BOTTOM_FIRST | /usr/bin/y4munsharp -L 1.0,0.2,0 | /usr/bin/yuvmedianfilter -r 6 -T 3 -t 0 | /usr/bin/mpeg2enc -v 0 -r 32 -4 1 -2 1 -g 12 -G 12 -I 1 -B 384 -b 9500 -f 8 -o $1 However, my script uses CBR bitrate. Your script uses a VBR bitrate for video, that's right. Unfortunately, I should have explained more clearly what I am looking for. I would like to MULTIPASS the video. My goal is to put my video on a DVD with the highest quality possible. If my movie was less than 30 minutes for example, I could encode it using a 9800kbits CBR. But since it's around 1h30 long, I need to use a lower bitrate. A VBR allocates more kbits on parts of the movie which need it (a fast action scene for example), while using few kbits on part which do not really need it (a very slow traveling for example). However, I think the way mpeg2enc and mencoder (multipass mode) allocate kbits is really different. When encoding in multipass mode with mencoder, all the movie complexity is taken into account to allocate the kbits. That's what the first pass is for. Well, I'm doing some tests right now, and I'll see if there's any difference. Right now, I test the following command lines : # mencoder 1st pass : nice -19 mencoder movie.mov -nosound -ovc lavc -of rawvideo -mpegopts format=dvd -vf scale=720:576,harddup -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=8000:\ keyint=15:trell:mbd=2:precmp=3:subcmp=3:cmp=3:dia=-10:predia=-10:\ cbp:mv0:vqmin=1:lmin=1:dc=10:aspect=4/3:psnr:vpass=1 -ofps 25 -noskip -o movie.m2v # mencoder 2nd pass : nice -19 mencoder movie.mov -nosound -ovc lavc -of rawvideo -mpegopts format=dvd -vf scale=720:576,harddup -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=8000:\ keyint=15:trell:mbd=2:precmp=3:subcmp=3:cmp=3:dia=-10:predia=-10:\ cbp:mv0:vqmin=1:lmin=1:dc=10:aspect=4/3:psnr:vpass=2 -ofps 25 -noskip -o movie.m2v # AC3 encoding : ffmpeg -i movie.mov -ar 48000 -ab 192 movie.ac3 # multiplexing : mplex -f 8 movie.ac3 movie.m2v -o movie.mpeg2 I already produced a movie.mpeg2 file which plays fine on my computer. I'll have to test it on my standalone player. Nicolas. _______________________________________________ Cinelerra mailing list [email protected] https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra
