[mythtv] 0.21 and ffmpeg handling of corrupt ac3

Scott D. Davilla davilla at 4pi.com
Fri Apr 18 21:01:54 UTC 2008

>On Fri, Apr 18, 2008 at 1:30 PM, Scott D. Davilla <davilla at 4pi.com> wrote:
>>  >On Wed, Apr 16, 2008 at 5:31 PM, Tom Dexter
>>   ><digitalaudiorock at gmail.com> wrote:
>>   >It occurred to me that, if at any point mythtv uses a newer version of
>>   >ffmpeg, this issue will pretty much fix itself.  In any case, if
>>   >anyone thinks I should log a bug, and maybe post my patch for anyone
>>   >looking for a quick fix, let me know.  I already posted it to the
>>   >users list.
>>   Just a though, but how about fixing these problems at the source
>>   before they get propagated to disk at the backend. For DVB and
>>   HDHomeRun, the backend load is very light and since one would just be
>>   doing crc checks and fixes, this would not add much to the backend
>>   load.
>>   That way, the recorded file is guaranteed "clean". Sort of solve the
>>   problem at the source and eliminate "garbage in garbage out".
>  >
>I'm far from being really knowledgeable when it comes to video
>processing, but is that CRC check even possible without actually
>demuxing the file and decoding the ac3?
>For what's it's worth, I was doing very extensive tests of CPU usage
>after my 0.21 upgrade, so I had detailed notes of my frontend CPU
>usage for 720p and 1080i.  That patch added absolutely no measurable
>CPU usage to the frontend in my situation.

CRC checks are pretty fast to begin with. There's several crc checks 
inside a ts stream, the ac3 has it's own. You do have to demux to get 
down to the ac3 crc but I don't think you have to decode the ac3. So 
the (simplified) process would be a) check the ts packet, b) demux 
(not trivial) c) check individual CRCs, d) "fix" the bad ones, e) 
remux and repackage into a ts.

I did a quick look about and there's not much in the way of Linux 
source code for repairing mpeg2 ts streams. ProjectX seems to be what 
Linux users use. A command-line tool for this function would be a 
good way to start, validate the code there, then do an backend patch 
once you think it works;) The demux/remux seems to be the real issue 
as one has to handle all the various internal variations.

More information about the mythtv-dev mailing list