Difference between revisions of "Mencoder"

From Tomelec
Jump to: navigation, search
(Scaling and MPEG4 encoding)
(MOV from digital camera to MPEG4)
 
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
Encode a raw DV file from a digital video camera to MPEG4 video with mp3 audio.
 
Encode a raw DV file from a digital video camera to MPEG4 video with mp3 audio.
 
  <nowiki>mencoder input.dv -vf pp=lb -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2000 -oac mp3lame -lameopts vbr=3 -o output.avi</nowiki>
 
  <nowiki>mencoder input.dv -vf pp=lb -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2000 -oac mp3lame -lameopts vbr=3 -o output.avi</nowiki>
Adjust ''vbitrate'' to your needs. ''vbitrate=2000'' produces a quite good quality at a small filesize for videos in TV resolution.
+
Adjust ''vbitrate'' to your needs. ''vbitrate=2000'' produces a quite good quality at a small filesize for videos in TV standard resolution.
  
 +
== MOV from digital camera to MPEG4 ==
 +
<nowiki>for file in *.MOV; do echo $file; mencoder "$file" -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1024 -oac mp3lame -lameopts cbr:br=128 -of avi -o `basename $file | cut -d. -f 1`.avi; done</nowiki>
  
 
== Scaling and MPEG4 encoding ==
 
== Scaling and MPEG4 encoding ==
 
Scale a high resolution video down to a lower resolution, preserving the aspect ratio. MPEG4 encoding options as usual.
 
Scale a high resolution video down to a lower resolution, preserving the aspect ratio. MPEG4 encoding options as usual.
This scales any video that ''mencoder'' is able to read to a 480p video (480 pixels high).  
+
This scales any video that ''mencoder'' is able to read to a [http://en.wikipedia.org/wiki/480p 480p] video (480 pixels high).  
 
  <nowiki>mencoder input.mov -vf scale=-3:480 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=3000 -oac mp3lame -lameopts vbr=3 -o output.avi</nowiki>
 
  <nowiki>mencoder input.mov -vf scale=-3:480 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=3000 -oac mp3lame -lameopts vbr=3 -o output.avi</nowiki>
 
'''-vf scale=-3:''' calculates the with of the video using the original aspect ratio and the desired height.<br>Other scaling options as noted in ''mplayer´s'' manpage:
 
'''-vf scale=-3:''' calculates the with of the video using the original aspect ratio and the desired height.<br>Other scaling options as noted in ''mplayer´s'' manpage:
Line 18: Line 20:
 
-3:  Calculate w/h using the other dimension and the original aspect ratio.
 
-3:  Calculate w/h using the other dimension and the original aspect ratio.
 
-(n+8): Like -n above, but rounding the dimension to the closest multiple of 16.</nowiki>
 
-(n+8): Like -n above, but rounding the dimension to the closest multiple of 16.</nowiki>
 +
 +
== Windows Media (WMV) encoding ==
 +
Encode WMV1 with the given bitrate and no sound.
 +
<nowiki>mencoder video.mp4 -ovc lavc -lavcopts vcodec=wmv1:vbitrate=256 -nosound -o output.avi</nowiki>

Latest revision as of 21:30, 19 February 2013

Hint: all video filters (-vf option) can be previewed using mplayer before starting the actual encoding procedure.


DV to MPEG4 with deinterlacing

Encode a raw DV file from a digital video camera to MPEG4 video with mp3 audio.

mencoder input.dv -vf pp=lb -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2000 -oac mp3lame -lameopts vbr=3 -o output.avi

Adjust vbitrate to your needs. vbitrate=2000 produces a quite good quality at a small filesize for videos in TV standard resolution.

MOV from digital camera to MPEG4

for file in *.MOV; do echo $file; mencoder "$file" -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1024 -oac mp3lame -lameopts cbr:br=128 -of avi -o `basename $file | cut -d. -f 1`.avi; done

Scaling and MPEG4 encoding

Scale a high resolution video down to a lower resolution, preserving the aspect ratio. MPEG4 encoding options as usual. This scales any video that mencoder is able to read to a 480p video (480 pixels high).

mencoder input.mov -vf scale=-3:480 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=3000 -oac mp3lame -lameopts vbr=3 -o output.avi

-vf scale=-3: calculates the with of the video using the original aspect ratio and the desired height.
Other scaling options as noted in mplayer´s manpage:

 0:   scaled d_width/d_height
-1:   original width/height
-2:   Calculate w/h using the other dimension and the prescaled aspect ratio.
-3:   Calculate w/h using the other dimension and the original aspect ratio.
-(n+8): Like -n above, but rounding the dimension to the closest multiple of 16.

Windows Media (WMV) encoding

Encode WMV1 with the given bitrate and no sound.

mencoder video.mp4 -ovc lavc -lavcopts vcodec=wmv1:vbitrate=256 -nosound -o output.avi