Introduction
The idea here is to convert all the files into the .mp4 format so that they can be played in chrome and via the chromecast. Mostly files will come in as .avi or .mkv files. So this covers converting those two types to .mp4
Downloading AVCodec
First you will need to obtain the avcodec application, it can be obtained using the following command:
sudo apt-get install libav-tools
Finding Files
A Handy command for finding the files you need to convert:
find . -name "*.avi"
find . -name "*.mkv"
Converting AVI to MP4
Unfortunately moving from avi to mp4 requires transcoding, which is a longer effort
avconv -i {input_file}.avi -c:v libx264 -c:a copy {output_file}.mp4
Converting MKV to MP4
Since mkv is mostly compatible with mp4, you just need the streams moved from one container to another
avconv -i {input_file}.mkv -codec copy {output_file}.mp4
Sometimes the audio is in AC-3, or has multiple channels, things that chromecast/browsers may not appreciate. So in those cases you can choose to transcode the audio
avconv -i {input_file}.mkv -vcodec copy -strict experimental -acodec aac -ac 2 -ab 93k -{output_file}.mp4
You could also transcode into mp3, which is a generally accepted format for .mp4. This also has the benefit of not requiring an experimental feature set
avconv -i {input_file}.mkv -vcodec copy -acodec mp3 -ac 2 -ab 192k -{output_file}.mp4
No comments:
Post a Comment