Handbrake Stream Support fixes checked in

I’ve checked in some fixes to the Handbrake Stream support (SVN revision 976). Basically the fixes came down to a few areas:

  1. Streams originating on an HDHomeRun but exported by EyeTV have a PAT which lists all the programs in the stream as delivered by the HDHomeRun (i.e. although the HDHomeRun supports program filtering on the transport stream EyeTV doesn’t seem to use it). However the stream only contains a single PMT for the actual program exported.
  2. There was some mismatching of indices within the scanning code such that audio streams might not have been handled correctly, which meant that Handbrake would think no audio was present and then declare the entire title as invalid.
  3. I’ve also added code to support PMT’s which span more than one Transport Stream packet, though I’ve not really got any streams to fully test this so it might be broken.

Posted under Handbrake

This post was written by awk on September 21, 2007

Handbrake Stream Support Bug fixes.

It looks like there’s a small bug in the Handbrake Transport Stream support in V0.9.0. Basically many transport streams won’t work correctly because of presence of multiple audio streams which confuses the ‘audio format sniffing’ code.

I’ve uploaded a patch to http://www.awkward.org/handbrake/hb_090_stream.c.patch it should apply to the current SVN head for Handbrake. I’m waiting on agreement from other devs as to when it will be committed to the repository.

Posted under Handbrake

This post was written by awk on September 17, 2007

Handbrake 0.9 Released

Version 0.9 of Handbrake has been released. This version incorporates both my Transport/Program Stream changes, and also the fixes for MPEG-2 Audio, no need to get the source and build it yourself if those things are something you want.

There are a lot of other new things in this version, including a revised Mac UI and much better de-interlacing algorithms.

The servers are under a fair amount of load right now, so the download might be a bit sluggish, be patient.

Posted under Handbrake

This post was written by awk on August 20, 2007

Handbrake MPEG 2 Stream Support

I’ve finally found the time to update my tree and commit my changes to Handbrake to add support of MPEG 2 Transport and Program Streams. SVN Change #648 has the relevant adjustments.

Posted under Development, Handbrake

This post was written by awk on July 3, 2007

“Final” Handbrake Transport Streams Patch

Probably not totally final – since it has at least one issue (but I think it’s a edge case) – but I’ve put a pretty much complete patch at http://awkward.org/handbrake/mpeg2-ts-patch.tar.gz

In addition to applying the patch you’ll need to manually add libhb/stream.c to the XCode project (and/or Makefile if you use that).

This patch should handle program streams with both MPEG and AC-3/A.52 audio formats, it will also handle transport streams with AC-3/A.52. However transport streams with audio formats won’t work (you’ll probably just get silence, it might crash). Unfortunately I don’t have much sample media to divine what’s really going on, and for my other project it’s not something I need (otherwise I’d have a lot more test data 8-).

So try it out – let me know of bugs – on the Handbrake Forum is probably best.

Posted under Handbrake

This post was written by awk on May 16, 2007

MPEG-2 Audio in Handbrake – A Patch

I’ve put a patch for the MPEG-2 audio handling problems in handbrake at http://awkward.org/handbrake/mpeg2-audio-patch.txt . The patch is just for libhb/decavcodec.c since that’s the only bit that needs any changes. However it can be combined with my transport stream patch to decode the output from EyeTV etc in Europe.

There’s still a chance that some stream formats may not decode properly – basically it looks like anything other than stereo may still be broken (but was broken before).

Posted under Handbrake

This post was written by awk on May 2, 2007

MPEG Audio in Handbrake

Unfortunately transcoding anything other than AC-3/A52 audio in Handbrake seems broken right now. For a lot of people in Europe where digital broadcasting uses MPEG Audio rather than AC-3 this makes my stream support a lot less interesting since they can’t transcode from (for example) EyeTV saved files to H.264 with Handbrake.

So I’m taking a look at the problem. Basically it looks like a change to the ffmpeg/libavcodec libraries in late 2006 was not matched with the appropriate ‘client’ changes in Handbrake. The ffmpeg project removed some redundant parsing code from the audio decoding functions which means that clients must now call the parser seperately before handing the data to the decoder.

I had just enough time last night to drop in the parser calls and things have definately improved, however since decoding is now slightly decoupled (through the parser) from the actual presentation of data the timestamps on the decoded data are not advancing correctly. The timestamp problems cause Handbrake’s sync code to introduce chunks of silence. Hopefully this evening I’ll find the time to fix up the timestamps and create a patch folk can try out.

Posted under Handbrake

This post was written by awk on May 2, 2007

Transport Stream Support

An initial version of patches to Handbrake to support Transport Streams (and Program Streams) is now available at http://awkward.org/handbrake/mpeg2–ts-patch.tar.gz . These patches should apply cleanly against SVN Rev 552 (you mileage may vary with other revisions – but libhb has been relatively stable). In addition to unpacking the archive and applying the included patches you’ll need to add libhb/stream.c to the XCode Project file -> libhb Sources folder (libhb and libhb dlib targets). I’ve not included a patch to do this since patching XCode Project files is usually a hit and miss affair.

These changes should support the style of transport streams in common use here in the US for Digital Broadcasting (MPEG-2 Video Streams and AC3/A52 audio streams). Although multiple audio streams in a transport file will be displayed in the audio tab on handbrake so you can choose the one you want only one video stream is supported (no real PMT/PAT support in this patch). Also if the transport stream contains audio other than AC3/A52 it will not be handled correctly, LPCM and MPEG-2 Audio in a program stream should work but there’s some evidence of issues in Handbrake with those audio types.

Next on my to-do list (besides any bugs that might come up) is looking into that non-AC3 audio problems in Handbrake, and then real multiple program transport stream support.

Posted under Handbrake

This post was written by awk on April 26, 2007

HandBrake 0.8.5b1 Released

The team working on HandBrake have released a new beta – the first since the project went through a bit of an upheaval. There’s lots of good stuff in the update, including preset support and a Windows GUI, the full details are at here.

None of my work is in this beta since it was being prepped before I started on the program and transport stream implementation. However there’s a strong chance that the next beta will include the work.

Posted under Handbrake

This post was written by awk on April 21, 2007

Progress Update

I’ve made some more progress in handling MPEG-2 Transport Streams in Handbrake.

I have something now that pretty much seems to work (I’m doing a test transcode as I type). The ‘preview’ pictures in Handbrake seem to work fine and that’s usually a pretty good indication of things.

However it has a few too many hardcoded ‘magic’ values and needs some cleanup before I can prepare a real patch. I’ve also realized that my ‘hack’ to force the duration to 4 Hours for streams where I can’t seem to calculate the duration completely throws off the ‘time remaining’ calculations of Handbrake progress bar – I probably need to revisit that problem again.

Posted under Handbrake

This post was written by awk on April 18, 2007