Eric H. Johnson on 4 Nov 2015 15:05:35 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Sound and MKV files


I ran that and got a warning that experimental codecs are not enabled, and to use “-strict -2”. Did that and it did then run, however the result was the same as handbrake, no sound.

What I still do not understand is why the Sony TV works, while the Panasonic does not. The Panasonic is the older TV so I suppose there could be something in the protocol that the Sony supports, but the Panasonic does not.


What happened was that handbrake did not reencode the AC3 audio to AAC.  Technically speaking, since MP4 (and MKV) are container formats, AC3 and AAC a both legally acceptable.  However, Chromecasts are not great devices for video support because not only are they picky about codecs, they are picky about container formats and what is in them.  I was hoping Google would put some into fixing this so that there would be better support but atter the software upgrade this year, the poor support remains.

So...  although you can use handbrake (I have occasionally), I prefer to use ffmpeg for video work since I can more easily control exactly what I want.  Here is the conversion line I use to transcode to MP4.

ffmpeg -y -i test.mkv -ar 48000 -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -preset veryfast -f mp4 -crf 17 -threads 0 test.mp4

(note: I'm not specifying AAC here because that is the default audio type for mp4... you'll see it identified as mp4a)

This is not the tightest encoding you can do- you can use a different preset (or profile).  The "veryfast" gives very good quality without taking too long to run.  Slower presets will take longer (i.e. processing at a slower fps) but the file sizes will be relatively smaller.

I use a similar line to transcode the videos that get uploaded, with the addition of 

MP4Box -inter 500 test.mp4

which interleaves every 500ms.  This is typically needed for HTTP streaming (e.g. video servers like jwplayer) so that you can skip back and forth and do progressive downloads but it may not be needed by the Chromecast.  Definitely doesn't hurt.

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --