really a good joob. i vote to include this on the wiki page.
En/na Nicolas ha escrit:
Hello, I put here the command lines I used to export to several formats the videos I make with Cinelerra. I hope that will help someone reading the mailing-list archives in the future. Cinelerra is an EXCELLENT tool, but its export formats aren't perfect. Fortunately, there's always a good method to use to get your video in the format and quality you need. The command lines assume your input is PAL, 25fps and progressive. You'll have to add/modify some parameters if your video is interlaced. 1 - ENCODING A CINELERRA VIDEO TO DVD WITH THE "NOT SO GOOD" METHOD ------------------------------------------------------------------- Here are the syntax I used to "two pass encode" the .mov file into an mpeg2 video. The .mov file is a progressive (non interlaced) video produced by Cinelerra (Quicktime DV+Audio 2 complements). You have to add some parameters to the mencoder command lines if your .mov file is interlaced (look at the ilmv, ildct and ilme parameters). mencoder -nosound -ovc lavc -of rawvideo -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vbitrate=7500:vrc_maxrate=9800:vrc_minrate=2000:\ vrc_buf_size=1835:keyint=15:trell:mbd=2:precmp=3:subcmp=3:cmp=3:\ dia=-10:predia=-10:preme=2:cbp:mv0:vqmin=1:lmin=1:dc=10:aspect=4/3:vpass=1 -ofps 25 -noskip -o /dev/null movie.mov mencoder -nosound -ovc lavc -of rawvideo -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vbitrate=7500:vrc_maxrate=9800:vrc_minrate=2000:\ vrc_buf_size=1835:keyint=15:trell:mbd=2:precmp=3:subcmp=3:cmp=3:\ dia=-10:predia=-10:preme=2:cbp:mv0:vqmin=1:lmin=1:dc=10:aspect=4/3:vpass=2 -ofps 25 -noskip -o movie.m2v movie.mov I don't mux audio and video streams with mencoder, since the mpeg muxer is bugged right now. Therefore, I encode the audio stream to AC3 using ffmpeg: ffmpeg -i movie.mov -ar 48000 -ab 384 movie.ac3 I then multiplexed the audio and video streams with mplex: mplex -f 8 -V movie.ac3 movie.m2v -o movie.mpg The result is good, but you can get a better result with mpeg2enc in 5 to 10 times less time... 2 - DIRECTLY EXPORTING TO MPEG2 FROM CINELERRA IS THE BEST SOLUTION ------------------------------------------------------------------- I will continue to use the same method I used before, because that is how I get the best looking video. I directly convert the YUV4MPEG stream from Cinelerra with mpeg2enc using a pipe. Mpeg2enc is part of the mjpegtools suite. It produces a very good quality video, its syntax is simple and it's fast! =) # For interlaced: y4munsharp -L 1.0,0.2,0 | yuvmedianfilter -r 6 -T 3 \ yuvcorrect -T INTERLACED_BOTTOM_FIRST | mpeg2enc -v 0 -r 32 -4 1 -2 1 -s -P -q4 -g 15 -G 15 -I 1 -B 384 -b 9800 -f 8 -o $1 # For progressive: y4munsharp -L 1.0,0.2,0 | yuvmedianfilter -r 6 -T 3 \ -t 0 | yuvcorrect -T NOT_INTERLACED | mpeg2enc -v 0 -r 32 -4 1 -2 1 \ -s -P -q4 -g 15 -G 15 -I 0 -B 384 -b 9800 -f 8 -o $1 That command line was made with suggestions from some of you on this mailing-list. =) I then export an AC3 sound file from cinelerra, and combine audio and video stream: mplex -f 8 -V -r 10286 audio.ac3 video.m2v -o audio_video.mpeg yuvcorrect is used in order to pass to mpeg2enc the good interlacing mode. That solves a bug of Cinelerra in batch rendering mode. (SVN version fetched in february 2006) The value of the -r parameter must be adjusted accordingly to the bitrates you use. I'm not sure one MUST set the video buffer (-b) in the mplex command line. On a DVD, I think the value is 1835 (that's what I read in the mencoder docs). 3 - ENCODING TO FLV FORMAT -------------------------- I also encode the videos I make with Cinelerra into .flv files (FLash Video). The file weight is very small and the only thing needed to play the video is an internet browser and a flash plugin. That's the format I use when I want to display my video on an HTML page. ffmpeg -i movie.mov -b 430 -s 320x240 -aspect 4:3 -pass 1 -ar 22050 movie.flv ffmpeg -i movie.mov -b 430 -s 320x240 -aspect 4:3 -pass 2 -ar 22050 movie.flv Pay attention to the output file extension. It's read by ffmpeg to set the output format. ffmpeg can be used to convert videos into a lot of different formats such as mpeg, asf, avi, flv, quicktime, wmv... It uses the libavformat library. 4 - ENCODING A MOV VIDEO TO DIVX FORMAT --------------------------------------- To get a divx video, I first export my work from Cinelerra into a .mov file. I then use mencoder to convert it to Divx4/5 and AVI container. Two pass encoding is a MUST for that format. Parameters are set in order to get a good result at a "medium" bitrate. I set those parameters to get files small enough to be sent over the internet. For video who are 3 minutes long, I get files whose weight is around 13Mo. If you want your divx video to be displayed properly on a stupid but well know media player which runs on Windows: - the aspect ratio information contained in the header won't be read by that player. That is why you really want to scale down the video in order for your video to be displayed with the good aspect ratio. Width and height must be multiples of 16. I recommend the following resolutions for a 4/3 PAL input video: 384:288, 448:336, 512:384, 704:528. - audio bitrate is CBR. Do not change it to VBR or that player would loose A/V sync - the -ffourcc parameter is needed for the video to be recognized as Divx Mencoder uses the libavcodec codecs. mencoder -oac pcm -sws 2 -vf scale=${width}:${height},hqdn3d=2:1:2 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=${video_bitrate}:vlelim=-4:\ vcelim=7:lumi_mask=0.05:dark_mask=0.01:scplx_mask=0.3:naq:v4mv:\ mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:aspect=4/3:sc_threshold=1000000000:\ vmax_b_frames=2:vb_strategy=1:dia=3:predia=3:cbp:mv0:preme=2:\ last_pred=3:vpass=1:psnr:cgop -ofps 25 -of avi movie.mov -o /dev/null -ffourcc DIVX mencoder -srate 32000 -oac mp3lame -lameopts cbr:br=${audio_bitrate}:\ aq=0 -sws 2 -vf scale=${width}:${height},hqdn3d=2:1:2 -ovc lavc \ -lavcopts vcodec=mpeg4:vbitrate=${video_bitrate}:vlelim=-4:vcelim=7:\ lumi_mask=0.05:dark_mask=0.01:scplx_mask=0.3:naq:v4mv:mbd=2:trell:\ cmp=3:subcmp=3:mbcmp=3:aspect=4/3:sc_threshold=1000000000:\ vmax_b_frames=2:dia=3:predia=3:cbp:mv0:preme=2:last_pred=3:vpass=3:\ psnr:cgop -ofps 25 -of avi movie.mov -o movie.avi -ffourcc DIVX 5 - CONCLUSION -------------- My advices to get the best results when converting your videos made with Cinelerra are: - export as an YUV4MPEG stream and encode with mpeg2enc if you want a mpeg DVD format, - export as a .mov file (Quicktime DV+audio 2 complements) and use ffmpeg to encode your video into an "exotic" format, - export as a .mov file (Quicktime DV+audio 2 complements) and use mencoder if you want a Divx video. Your mileage may vary. I set the parameters and choose the right encoder for each task after reading a ton of documentation and runing a lot of tests. Do not hesitate to comment and share your encoding tips for cinelerra videos! Hope that helps. =) Nicolas, Paris. _______________________________________________ Cinelerra mailing list Cinelerra@skolelinux.no https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra
-- ======================== ^ ^ O O (_ _) muzzol(a)mail.ru ======================== jabber id: muzzol(a)jabber.dk ======================== No atribueixis qualitats humanes als ordinadors. No els hi agrada. ======================== <echelon spamming> bomb terrorism bush aznar teletubbies </echelon spamming> _______________________________________________ Cinelerra mailing list Cinelerra@skolelinux.no https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra