Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # #########
- # # NOTES #
- # #########
- #
- #
- #
- # ***CROPPING***
- #
- # The following comes from the mencoder documentation on calculating the
- # proper crop values:
- #
- # First, we want to determine the appropriate crop rectangle, so we use
- # the cropdetect filter:
- # mplayer dvd://1 -vf cropdetect
- #
- # Make sure you seek to a fully filled frame (such as a bright scene,
- # past the opening credits and logos), and you will see in MPlayer's
- # console output:
- # crop area: X: 0..719 Y: 57..419 (-vf crop=720:362:0:58)
- #
- # We then play the movie back with this filter to test its correctness:
- # mplayer dvd://1 -vf crop=720:362:0:58
- #
- # And we see that it looks perfectly fine. Next, we ensure the width and
- # height are a multiple of 16. The width is fine, however the height is
- # not. Since we did not fail 7th grade math, we know that the nearest
- # multiple of 16 lower than 362 is 352.
- #
- # We could just use crop=720:352:0:58, but it would be nice to take a
- # little off the top and a little off the bottom so that we retain the
- # center. We have shrunk the height by 10 pixels, but we do not want to
- # increase the y-offset by 5-pixels since that is an odd number and will
- # adversely affect quality. Instead, we will increase the y-offset by 4
- # pixels:
- # mplayer dvd://1 -vf crop=720:352:0:62
- #
- # Another reason to shave pixels from both the top and the bottom is that
- # we ensure we have eliminated any half-black pixels if they exist. Note
- # that if your video is telecined, make sure the pullup filter (or
- # whichever inverse telecine filter you decide to use) appears in the
- # filter chain before you crop. If it is interlaced, deinterlace before
- # cropping. (If you choose to preserve the interlaced video, then make
- # sure your vertical crop offset is a multiple of 4.)
- #
- #
- #
- # ***SUBTITLES***
- # MPlayer prints the available subtitle IDs when run in verbose (-v) mode.
- # Example:
- # mplayer dvd://1 -v
- #
- # You will find a line that says something like this:
- # subtitle ( sid ): 0 language: en
- # number of subtitles on disk: 1
- #
- # Replace the "-sid 0" switch on the first pass to the subtitle ID that you
- # want (the example above shows 1 subtitle with ID 0)
- #
- #
- #
- # ***Audio***
- # The script is written to encode into AAC audio. This is an advanced,
- # high quality codec, capable of storing up to 64 channels of audio.
- # This is probably sufficient for most people, and saves space. If you
- # want to keep the original sound track and not re-encode the audio, you
- # must use the Matroska container, as the MP4 container only supports AAC.
- # To copy the original audio track, do the following:
- # CHANGE "-oac faac" TO "-oac copy" in both passes
- # REMOVE the "-faacopts ..." line in both passes
- # CHANGE "-o audio.aac" to audio.ac3 in the first pass
- # CHANGE "audio.aac" TO "audio.ac3" in the mkvmerge command
- # COMMENT out the MP4Box command
- #
- #
- #
- # ***OTHER NOTES***
- #
- # Keep in mind that this is made for movies - Other videos such as TV
- # shows are usually interlaced and at a different framerate.
- #
- # Don't forget to change your -dvd-device
- #
- #
- # -Brandon
- #First pass - dump audio
- mencoder dvd://1 \
- -oac faac \
- -faacopts br=256 \
- -alang en \
- -ovc x264 \
- -x264encopts bitrate=1400:subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b:threads=auto:pass=1 \
- -vf pullup,softskip,crop=704:352:8:62,hqdn3d=2:1:2,harddup \
- -mc 0 \
- -ofps 24000/1001 \
- -vobsubout subtitles \
- -vobsuboutindex 0 \
- -sid 0 \
- -dvd-device ./ \
- -of rawaudio \
- -o audio.aac
- #Second pass - dump video
- mencoder dvd://1 \
- -oac faac \
- -faacopts br=256 \
- -alang en \
- -ovc x264 \
- -x264encopts bitrate=1400:subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b:threads=auto:pass=2 \
- -vf pullup,softskip,crop=704:352:8:62,hqdn3d=2:1:2,harddup \
- -mc 0 \
- -ofps 24000/1001 \
- -dvd-device ./ \
- -of rawvideo \
- -o video.264
- # This will add audio and video files to an MP4
- # "apt-get install gpac" will install MP4Box
- MP4Box Muxed.mp4 \
- -add video.264 \
- -add audio.aac \
- -add subtitles.sub \
- -fps 23.976
- # This will mux the audio and video files to a
- # Matroska container
- # "apt-get install mkvtoolnix" will install this.
- mkvmerge -o Muxed.mkv \
- video.264 \
- audio.aac \
- subtitles.idx
- # Delete all the files - you prolly want to keep this
- # commented out and delete these manually.
- # rm video.264
- # rm audio.aac
- # rm divx2pass.log
- # rm subtitles.sub
- # rm subtitles.idx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement