Thanks for that - definitely seeing more success with TS. The problem transcoding seems to be tools (specifically, linux/osx cli ones) that can see the channel change in the stream - presumably the same issue as lots of players seem to have with the switch.
Latest ffmpeg compiled from source according to the docs here https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide seems to be ok though. It flashes up that audio changes are detected, and provided you force 6 channel output, it will then correctly transcode. This does have the downside that if the content is 2 channel, you get 4 blank channels… so you can't use PLII on it.
Working with TS, currently a command like this is working:
ffmpeg -ac:a 6 -i "$file.ts" -map 0:0 -map 0:1 -map 0:1 -c:a ac3 -r:a 48000 -b:a:0 192k -b:a:1 448k -ac:a:0 2 -ac:a:1 6 -c:v copy -strict 2 -sn "$file.ac3.ts"
End up with a 2 channel and a 6 channel soundtrack after that, both ac3. If the 6 channel has the blank channels, then you can use the 2 channel for PLII.
Ideally it'd be good if the ac3 switched from 2-6 channels with the source, but can't find a way to do that. My post process script wraps the above command, and ffmpeg does spit out the channel info as it goes, including changes in channel config with config info, so it may be that I can grep that to decide whether it is 5.1 or 2 channel and drop the streams as appropriate.
Above doesn't work with MKV at all though - get something like:
[mpegts @ 0xaacfce0] pts (2764800) < dts (2772000) in stream 0
av_interleaved_write_frame(): Invalid argument
Ben
On Wednesday, 10 April 2013 at 15:08, redmine@tvheadend.org wrote:
> Tvheadend - General: RE: UK Freeview HD Soundtrack Conversion to AC3? (
https://tvheadend.org/d/1099-uk-freeview-hd-soundtrack-conversion-to-ac3?r=8222#message-8222)
> Adam Sutton
> Couple of points:
> 1.
https://en.wikipedia.org/wiki/Advanced_Audio_Coding (LATM = Low Overhead
> Audio Transport Multiplex - don't ask me the details)
> 2. If its TS then its nothing to do with the contents of the file, since
> (assuming its TS passthru) it's exactly how the broadcaster provides the
> data (hence the argument for using TS to record stuff). So its the player.
> 3. For MKV there are definitely issues with stream changes, though in most
> cases the data is there (if mislabelled) and XBMC may be able to handle
> that. However I've not tried any of this as I pretty much only use freesat
> (which doesn't use AAC) and TS passthru.
> Adam
> On 9 April 2013 21:05, wrote:
> > Tvheadend - General: RE: UK Freeview HD Soundtrack Conversion to AC3?
> > Ben Lumley
> > I've been trying to read up on it... it's a confusing world though. I
> > think UK DVB-T2 (aka Freeview HD) uses AAC LATM for audio, I'm not quite
> > sure what the LATM means as such, to do with how the data is packed I
> > think. But that's the bit that's not so widely supported.
> > Based on reading + experimenting, I /think/ it's to do with the metadata
> > on the stream as well as the stream itself. I also think some tools use/pay
> > more attention to one/the other, hence the inconsistency. I also think
> > there's differences between 3.2 and 3.3 TVH (latest in both cases).
> > I've not yet found a stream, mkv or ts, where the audio data is missing
> > (there are some permutations I've not looked into as much though) - it's
> > just labelled/packed/something'd incorrectly - so you may be able to force
> > the correct audio out. TS seems better/more consistent than MKV though,
> > which is inline with what other threads say, and also what adamsutton said
> > in a brief IRC conversation last night.
> > ------------------------------
> > You have received this notification because you have either subscribed to
> > it, or are involved in it.
> > To change your notification preferences, please click here:
> >
https://tvheadend.org/my/account
> You have received this notification because you have either subscribed to it, or are involved in it.
> To change your notification preferences, please click here:
https://tvheadend.org/my/account