[MPlayer-users] crop, scale, expand, audio resample (basicley making DVD PAL combatible)

Heine Laursen maillist at gozar.dynu.com
Sun Mar 6 19:16:46 CET 2005


Hi.
I'll start off, by saying that I'm a noob, and know almost nothing about 
encoding, I'm useing the cvs version of mplayer.

I have an none dvd compatible mpeg file, who I want to make to dvd pal 
compatible. I want 25 Framerate and resolution of 704x480. I will write, 
the steps I have gone through, and would like some input, if I did it 
right, or if not, why.
The full joind command is near the buttom.

The file has the following specs (using -identify)
ID_VIDEO_FORMAT=0x10000002
ID_VIDEO_BITRATE=2520000
ID_VIDEO_WIDTH=480
ID_VIDEO_HEIGHT=480
ID_VIDEO_FPS=29,970
ID_VIDEO_ASPECT=1,3333
ID_AUDIO_CODEC=mp3
ID_AUDIO_FORMAT=80
ID_AUDIO_BITRATE=128000
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
ID_LENGTH=4284

There are borders on both width, and hight. so using mplayer -vf 
crop=x:x:x:x I came up with the following crop ( cropdetect did'ent work 
for me) crop=440:280:25:-1
In order to get the width to 704 and keep the aspect I took 440 and 
divided it with 704. That gives me the numper 1,6. So I multiplyed the 
hight with 1,6 to keep aspect. That gives me a hight of 448. that gives 
me the scale=704:448
The hight need to be 480 so I need to add a black border, with 
expand=704:480
The hole video processing:
-vf crop=440:288:25,-1,scale=704:448,expand=704:480

The audio rate is also wrong. I need a audio rate of 48000, so I need 
the audo resample filer -af resample 48000. The man page also tells me 
that I need the -srate so the audio prosessing looks like these:
-af resample=48000 -srate 48000

The framerate is ntfs, that I'll solve with:
-ofps=25

Now In order for any of the abow to actully have any meaning I need to 
reencode both video and audio.

I came up with the following for video:
-ovc lavc -lavcopts vcodec=mpeg2video:aspect=16/9:keyint=25
vcodec=mpeg2video, becaues it's mpeg2 video in dvd.
aspect=16/9 well, because that's what looked best while testing :-)
keyint=25, because I want a seekable dvd, and keyint have somthing to do 
with that :-)

for audio:
-oac lavc -lavcopts acodec=mp2:bitrate=128
acodec=mp2, I just want to be sure it's mp2 (mp2 is default lavc audio 
codec)
bitrate=128, because the bitrate is 128 to start with. no need to waste 
space with a higher bitrate

I also need:
of mpeg -mpegopts format=dvd, again because I want to produce a dvd, and 
this have somthing to do with muxing i think!

The hole command joined togeather looks like this:
mencoder -vf crop=440:288:25,-1,scale=704:448,expand=704:480 -af 
resample=48000 -srate 48000 -of mpeg -mpegopts format=dvd -ofps 25 -ovc 
lavc -oac lavc -lavcopts 
vcodec=mpeg2video:aspect=16/9:keyint=25:acodec=mp2:bitrate=128 -o 
output_file.mpeg input_file.mpeg

Now, does that get me a valid dvd pal compatible mpeg file, ready to be 
used with dvdauthor software?

also note I have also tryed with -mc 0 -noskip, but then the audio/video 
was out of sync!

Thanks for reading.
-- 
Sincerley
Heine Laursen




More information about the MPlayer-users mailing list