Milosch's Shell Snippets

Converting a video file for the Barnes & Noble Nook Color
Converts every video supported by ffmpeg to a 840x480 sized video with 44.1kHz sampling rate, two audio channels, 160kBit maximum audio bit rate and 2000 kBit maximum video bitrate.

ffmpeg -i INFILE.EXT -strict experimental -b 2000k -s 854x480 -ar 44100 -acodec aac -ac 2 -ab 160k OUTFILE.mp4

Feel free to add the command "nice" in front of ffmpeg (nice ffmpeg -i ...) to make sure the conversion process doesn't clog your computer.

Converting a Blu-ray into something meaningful without quality loss or re-encoding
Use SmartLabs tsMuxeR to extract only the audio and video tracks from the M2TS you're interested in. I prefer their GUI application tsMuxerGUI to interactively select the tracks which I'm interested in: tsMuxerGUI Please remember the frame rate detected by tsMuxerGUI as you need it in the next step. Here you join all these files into a MKV container without re-encoding audio or video. mkvmerge \ --default-duration 0:23.976fps YourVideoTrack.264 \ --language 0:deu YourGermanAudioTrack_4352.ac3 \ --language 0:fre YourFrenchAudioTrack_4353.dts \ --language 0:eng -y 0:1400ms YourSubtitleFile.srt \ -o YourOutputMovie.mkv

In this example you see multiple audio tracks combined, the frame rate specified and a delay of 1400ms specified for the subtitles text file to the Video file. You can use the -y parameter also with the other tracks if they don't sync - just put it before the track you want to adjust. Alternatively you can use mmg to interactively combine and configure your tracks: mmg

Re-encoding a video AC3/DTS/TrueHD audio tracks to stereo without touching the video
First extract the audio track and encode it to mp3 two channel at Hifi quality (2 channels, 48kHz and 256k bit rate) using ffmpeg: ffmpeg -vn -i YourMovie.mkv -acodec libmp3lame -ac 2 -ar 48000 -ab 256k YourMovie.mp3 Then use mmg (mkvmerge GUI) where you add YourMovie.mkv, but deselect the unwanted audio track and add the new YourMovie.mp3 file you created in the previous step to replace the old track.