Keith C. Perry on 6 Nov 2015 10:57:48 -0800

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

Re: [PLUG] Sound and MKV files

I usually end up compiling ffmpeg and the codecs needed to produce mp4s since its usually out of date in the repositories.

If you want to send me the file I'd be more than happy to see what happens (and what the fix was).

I haven't had ffmpeg fail to convert something to mp4 for a number of years now.

Also, the TV really should not be an issue unless you're passing the audio through the TV (e.g. over s/pdif or hdmi to a receiver that will decode and play audio to your speakers).  For a stereo mix something would really have to be strange there since that is pretty common but for 5.1 AAC I could see and issue as most TV are not going to directly decode that.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 
Keith C. Perry, MS E.E. 
Owner, DAO Technologies LLC 
(O) +1.215.525.4165 x2033 
(M) +1.215.432.5167

----- Original Message -----
From: "Eric H. Johnson" <>
To: "Philadelphia Linux User's Group Discussion List" <>
Sent: Wednesday, November 4, 2015 6:05:35 PM
Subject: 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  --
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --