Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
3rd March 2011, 16:39 | #1 | Link |
Registered User
Join Date: Feb 2009
Posts: 16
|
libavcodec's mpeg-2 encoder (mencoder / ffmpeg)
Part 1. Multiplexing problem
I'm trying to encode DVD-compliant sources to output them to dvdauthor. AFAIK, i need to make mpeg-ts stream with NAV-sectors and empty VOBU-sectors. For example, one of the following lines would do what i want: Code:
mplex -f 8 -o test_mux_mplex.vob test.m2v test.ac3 Code:
mencoder -noskip -mc 0 -oac copy -ovc copy\ -of mpeg -mpegopts format=dvd:tsaf:vwidth=720:vheight=576:vaspect=4/3:vframerate=25\ -audiofile test.ac3 test.m2v -o test_mux_mencoder.vob Next wrote this script: Code:
Video_Blank = BlankClip(length=1500,\ width=720,\ height=576,\ pixel_type="YV12",\ fps=25,\ audio_rate=48000,\ stereo=true,\ sixteen_bit=true,\ color=$000000).\ AssumeFrameBased().\ ShowFrameNumber(x=32,\ y=64,\ font="DejaVu Sans",\ size=32,\ text_color=$E0E0E0,\ halo_color=$404040).\ ColorYUV(levels="PC->TV") return Video_Blank Code:
wine wavi test1500.avs - /R |\ ffmpeg -ar 48000 -ac 2 -acodec pcm_s16le -f s16le -i pipe:0\ -acodec ac3 -ab 192k -f ac3 test.ac3 &&\ wine avs2yuv -raw test1500.avs - | mencoder -profile mpeg2-vhq-pal-p-i420-bitrate-pass1\ -oac copy -lavcopts vbitrate=9000:aspect=4/3:threads=4\ -audiofile test.ac3 -o test.vob - Even if i tried to demux video, mpeg-es (m2v) still has 1500 frames. Code:
mpeg2desc -v 0 -o test.m2v < test.vob Code:
mplex -f 8 -o test_out_mplex.vob test.m2v test.ac3 &&\ mencoder -oac copy -ovc copy -of mpeg\ -mpegopts format=dvd:tsaf:vwidth=720:vheight=576:vaspect=4/3:vframerate=25\ -noskip -mc 0 -audiofile test.ac3 test.vob\ -o test_mux_mencoder.vob Then i made index for avisynth of two files. Both muxers drops frame with stamp «1498» (the last frame should have stamp «1499»). If i run this sequence one more time then mplex drops one more frame: Code:
mpeg2desc -v 0 -o test_again.m2v < test_out_mplex.vob &&\ mplex -f 8 -o test_again.vob test_again.m2v test.ac3 Why this occurs? Last edited by ar; 3rd March 2011 at 18:54. Reason: to make commandline short |
21st March 2011, 18:02 | #2 | Link |
Registered User
Join Date: Feb 2009
Posts: 16
|
Part 2. MPEG-2 encoding quality with MEncoder (libavcodec).
By default it's trash. But if i hit with a hammer -lavcopts somewhere, quality becomes very nice. For example, SSIM test on «Elephant's Dream» with PAL sequense at averange bitrate 5Mbps (peak 8.7Mbps):
Also, my profile from mencoder.conf:mencoder_conf.7z Last edited by ar; 27th March 2011 at 15:16. Reason: mencoder.conf profile added |
24th March 2011, 16:01 | #6 | Link |
Registered User
Join Date: Feb 2009
Posts: 16
|
Both cases i set encoder's MAX_KEYINT option to 15, because i want to get DVD-compliant MPEG-2 stream. Each encoder have scene change detection feature, so GOP size never exceeds 15 frames. Also, i post configuration file.
|
Tags |
dvd, ffmpeg, mencoder, mplex |
|
|