ffmpeg conversion for Chromecast

From Wikistix
Jump to navigation Jump to search

On an old Google Chromecast 1, I've found the following to produce playable content:

ffmpeg4 -i input.mp4 -preset fast -c:a aac -b:a 192k -ac 2 -c:v libx264 -b:v 1024k -profile:v high -level 4.1 -crf -1 -pix_fmt yuv420p output.mp4

More complex transcoding is possible. Eg. With an input where the video is fine, but the audio stream is aac 5.1 and refuses to play, we can copy the video stream, and map the audio stream twice, keeping the aac 5.1 stream and adding a second 192kb/s aac stereo stream. Eg.

ffmpeg4 -i input.mp4 -map 0:v:0 -c:v copy -map 0:a:0 -map 0:a:0 -c:a:0 aac -ac:a:0 2 -b:a:0 192k -c:a:1 copy output.mp4

From DVD files[edit]

Using the 3rd audio track (which are numbered from zero).

ffmpeg4 -i "concat:$(perl -e 'print join("|", @ARGV);' VTS_01_[1-9].VOB)" -map 0:v:0 -map 0:a:2 -preset fast -c:a aac -b:a 192k -ac 2 -c:v libx264 -b:v 1024k -profile:v high -level 4.1 -crf -1 -pix_fmt yuv420p output.mp4

Notes[edit]

  • aac 5.1 audio doesn't seem to work.
  • use -t <duration_secs> to test settings on a small portion of the file.
  • -crf -1 specifies constant quality mode, and is roughly equivalent to -crf 30. For higher quality, try, eg. -crf 25.
  • use eg. -s 1920x1080 to scale.

See also[edit]


Misinformation found herein copyright Paul Ripke (aka “stix”) stixpjr@gmail.com.