Project

General

Profile

Freeview HD audio drops

Added by Craig Fisher over 10 years ago

Hi

I'm having some problems with recordings of movies from the HD channels on Freeview, in that the sound just stops when the movie starts. I've done a bit of searching and found this thread ( https://tvheadend.org/boards/5/topics/6808?r=10652 )that seems to describe the issue as mainly affecting .mkv container recordings, when the audio goes from stereo to 5.1.

Unfortunately I was unaware of these problems with mkv before I set up the recordings and I seem to be stuck with a few unwatchable recordings of movies I'd really like to see :(

I'm posting here in the hope that someone knows of a way to recover these recordings into a usable state since none of the players I've tried will work (vlc, smplayer, xbmc, mpc)

Thanks!


Replies (20)

RE: Freeview HD audio drops - Added by Prof Yaffle over 10 years ago

All I can say is that I tried everything I could to recover the audio on my duff recordings... and failed. Nothing I tried, no application, no remuxing or transcoding, no header editor no ffmpeg channel mapping.

If there is a way, I'd gladly hear it, but otherwise I'd suggest you look at get_iplayer...

RE: Freeview HD audio drops - Added by Craig Fisher over 10 years ago

Ah that's a pity, nothing I've tried so far has worked either and unfortunately these particular movies are not available on the online catch up services.
Here's hoping something turns up to repair them...

Is matrotska the default recording format? I can't remember if I changed it or not, but if it is, seems to me it might be best to use passthrough by default for any new users?

RE: Freeview HD audio drops - Added by Prof Yaffle over 10 years ago

I think passthrough is the default... but it's aeons since I did a clean install so really can't remember. I'll check if I can.

RE: Freeview HD audio drops - Added by Rob Rob over 10 years ago

matroska is the default format, at least currently.

RE: Freeview HD audio drops - Added by Andy Furniss over 10 years ago

What actually makes the MKV?

I've never used MKV, but if it's ffmpeg (which I don't have on my TVH box), then there could be hope if it is using copy for the streams.

A test converting a ts with a 2-5 switch to mkv using acodec copy worked for me playing with svn mplayer (I don't think an old release will do)

I see in the linked thread that 1 year ago the sound would not have been there - but that was then and was supposedly fixed.

Maybe a sample could be uploaded somewhere to test.

RE: Freeview HD audio drops - Added by Craig Fisher over 10 years ago

If you can give me an idea of how to do this, I'll happily upload a sample of one of my mkv recordings if anyone wants to have a crack at it. Sample in question would be a recording of X-Men: First Class on Channel 4 HD here in the UK.

*Using XBMC, audio drops once the movie starts but resumes during the commercial breaks (with some video glitchiness thrown in at those transitions too)-
*VLC actually plays the movie audio, but only with severe skipping in the sound and no dialog (I guess it isn't doing the downmix to stereo properly)
*SMPlayer (mplayer gui) does not play movie audio at all, resumes audio during breaks after a few seconds with a temporary video freeze (similar to xbmc result) only this time, audio only plays in right channel with static on the left!

All of the above on a linux desktop btw.

Basically it's a mess; nothing seems able to handle it properly, with differing results from player to player

RE: Freeview HD audio drops - Added by Prof Yaffle over 10 years ago

Use mkvmergegui - it allows you to set cut points, so you can simply chop a section out of the file (e.g. the first few minutes, or cut at 10min to lose preamble ads/credits and again at 15min to lose the rest of the filme, then select the middle chunk). Ideally, a chunk that straddles a film/advertising break would be useful.

Have a look at VLC's codec information as it plays - particularly at those advert boundaries. You may see it move from 5.1 to stereo, and that's probably where the issue comes from... when I had the problem, I was left with what sounded like a backing track without dialogue, and we concluded that I was probably losing multiple channels and hence being left with front left and front right only, something like that.

RE: Freeview HD audio drops - Added by Andy Furniss over 10 years ago

Ahh, I guess you are on windows, I was thinking Linux until I saw mpc, so I am glad Prof had a suggestion for a sample as I haven't got a clue about windows.

If you had been on linux you could have just cut a chunk from the start big enough to include the switch + a bit by chopping the file.

I must admit the size may have been a problem if you have low upload bandwidth, and the issue of where to put it. If you have a gmail/google account that would have solved the latter as you get a couple of gig on google drive for free.

In some ways your observation about VLC answeres one important question - at least it seems that the sound is there, even if the player aparrently doesn't handle the switch well.

I looked at smplayer and it's using an mplayer version that's too old to work properly - not really anyway round that if you need a windows build.

As for VLC and XBMC - if you are not using the latest versions, maybe trying those or testing with a development build/snapshot if possible may help.

RE: Freeview HD audio drops - Added by Craig Fisher over 10 years ago

I do run linux (ubuntu 14.04), I just happen to have a windows install too for games and I figured I would try some win only players in vague hopes of something working. Size won't be a problem (though the whole mkv is >7GB) so If you can give me an idea of how to grab a chunk I go ahead and do that and get it upload somewhere. (dd perhaps? I'm not overly familiar with its use though, so help there would be nice). I'm on the latest version of all the other apps too.

RE: Freeview HD audio drops - Added by Andy Furniss over 10 years ago

That's handy so you can use dd. As it's mkv you can't just cut a chunk out - it's got to be from the start till some point after the sound switch, long enough to tell whether dialogue is there I suppose.

Of course if you have built things before you could try building mplayer from source, but that's going to need a lot of developer tools and devel headers of X installing - I can only guess as I don't use distros so already have them on my linux from scratch set up.

dd usage for mkv trial and error till you get enough from the start -

dd if=infile.mkv of=outfile.mkv bs=1024 count=100k

will make outfile.mkv from the first 100 meg of infile.mkv

adjust count=100k to get different sizes.

RE: Freeview HD audio drops - Added by Prof Yaffle over 10 years ago

If you're playing with files (Windows or Linux), you're inevitably going to need avidemux and mkvmerge at some point - at least, that's my experience.

The latter produces better mkv files as output, and can do it from multiple inputs - so you can concatenate files, move audio tracks from one to another, strip out streams, that sort of thing. I routinely use it to, say, drop the nar/audio description track from a file; I also recently used it to grab the burned-in subtitles from a disc (damned alien dialects :) ) and re-add them to the compressed BR rip I was watching.

So, yes, dd will do as you need - it'll hack the end off the file and you're not going to be tidy on your I-frames, but that's fine for what you need. But anything more than that and I'd recommend you have a look at mkvtoolnix.

http://www.bunkus.org/videotools/mkvtoolnix/downloads.html

Once you're there, it's as simple as loading the file and using the 'splitting' options on the 'Global' tab (e.g. split after duration 00:10:00.00 or split after timecodes 00:20:00,00:30:00).

Indeed, you can just use it to remux the file "as is" and re-tag the elementary streams to correct aspect ratio, language tags (so things default to NAR/ENG instead of NAR/Unknown), and so on.

I'm a fan, can't you tell? ;-)

RE: Freeview HD audio drops - Added by Craig Fisher over 10 years ago

Well if anyone is interested in having a crack at this, I have uploaded it to my google drive.

https://drive.google.com/file/d/0ByYdJZi73jMOUEE3NnV0VU5OUlk/

Do be warned that it is 1GB in size which is what it took to capture the movie up to the first ad-break to get the audio transitions into and out of the movie (1080i files are rather large, who knew! /sarcasm )
Might also be useful to xbmc/ffmeg/libav devs and whoever else handles this stuff...

RE: Freeview HD audio drops - Added by Andy Furniss over 10 years ago

Seems quite broken - but it's early days.

Is this cut with dd or something else? (if it's something else then that could be complicating things)

RE: Freeview HD audio drops - Added by Craig Fisher over 10 years ago

it's cut with dd

RE: Freeview HD audio drops - Added by Andy Furniss over 10 years ago

Ok that's good. at least nothing else has messed with it.

As for the stream, by total luck rather than anything else it seems mplayer forced to use faad rather than ffmpeg manages to play the 5.1 bits keeping dialogue.

There are complications though, once it has gone from 2 - 6ch it won't go back cleanly and just throws errors, this isn't too bad in the sense that you don't care about the ads, but the player sees it as a a/v desync - it does correct OK on the short ad at the start which it plays as fast as it can! (the sample is 2 then 6 announcer then 2 sponsor ad then 6 again for the film). For the proper ads of course I have nothing after then, but thay are longer and could be more problematic. You may have to skip them, or wait a while if it appears locked after initially fast playing, or possibly restart and use -ss to seek past them.

I tested ffmpeg aac and Fraunhofer, but both just play the stereo bits and throw errors for the 6ch.

I built vlc and that was stranger - like you said. It's using the exact same faad code as mplayer, but must be calling in a different way as it plays the initial 2ch and announcer 6ch but then gets confused into thinking the rate has changed to 44.1k then when the film starts properly it's throwing errors about timing and resampling the sound - it also seems that it isn't downmixing as the dialogue is missing. I didn't actually see that mplayer was downmixing so it could just be luck that mplayer when possible and by default requests the decoder to downmix to 2ch rather than doing it its self, which could be why it works better than vlc.

So in summary - it's broken :-) but by luck rather than design if you are prepared to install libfaad and mplayer all is not lost.

It may work without having to build your own, and the age of distro mplayer should be less of an issue here - though I am testing with current svn built after installing lib faad - I don't know if a distro build will have libfaad support or not.

If you are new to mplayer - it's going to be a pain using command line :-) Here's what I used, but what works best for you is somewhat dependent on your cpu/gpu specs.

mplayer -mc 0.5 -fs -demuxer lavf -lavdopts threads=4 -ac faad c4hd_xm_clip.mkv

On my box cpufreq on_demand is a pain when playing back vids, so I set all my cpus to performance.

FWIW faad has a long standing bug that really only shows on UK Freeview HD AAC 5.1 with dynamic range control, so you may notice the volume sometimes jumps around a bit - this is normal and a separate issue!

RE: Freeview HD audio drops - Added by Craig Fisher over 10 years ago

It seems I owe you many thanks!

I can confirm, for my recordings at least, that the use of libfaad as audio codec in mplayer (smplayer) allows the playback of the troublesome files. So happily, they wont go to waste after all :)

RE: Freeview HD audio drops - Added by Prof Yaffle over 10 years ago

This is really interesting... so does that mean that the audio track is merely incorrectly flagged in some way? Clearly the sound is there, so something else is up.

I don't know mplayer at all, but are there any mplayer-based tools that could re-tag, re-wrap or - in the extreme - re-encode files of this type? I've had more than my fair share of dodgy soundtracks over the years, although far fewer since I switched to ts.

RE: Freeview HD audio drops - Added by Craig Fisher over 10 years ago

I think mencoder would be the one to look into there. It's the encoder component that gets built with mplayer, so I assume that if mplayer can read and play something, then mencoder should be able to do the same if told to use the faad codec for the audio decoding.

RE: Freeview HD audio drops - Added by Andy Furniss over 10 years ago

Glad it worked, as for the detail of what's wrong with the stream, I am not sure.

I guess it's because the start is stereo and there is nothing to properly tell it about the change.

The errors produced by faad do indicate that it "knows" there is an unexpected channel layout change, but it seems to be luck/the way the player calls it as to whether it can resync.

I originally tested with just the sound extracted with ffmpeg -acodec copy. For some reason this behaved slightly differently with mplayer than sound + vid in that it couldn't recover from the second change like it did with vid, but could still play the 5.1 if I skipped past it.

I assume vlc does more querying of faad than mplayer in some way and gets confused by faad reading junk before it resyncs - hence thinking the stream has changed to 44.1k.

mencoder may work, but the problem will be getting proper vsync with chunks of sound missing (though I haven't tried) and of course it's not really supported anymore.

I guess the best thing is to use transport streams - if very rarely you get a no sound issue with those it could be "an unlucky start" that confuses the player.

The nice thing about ts is that you can cut them around anyway with dd and don't have to worry about headers. You should use bs=188 to maintain packets as some players like vlc are fussy about that. So to fix an unlucky start you could just do something like -

dd if=in.ts of=out.ts bs=188 skip=2000

and hope you get a better start.

Though I've never seen it with tvh, very rarely when using tzap/dvbstream to record long ago, it was possible to end up with just audio and vid streams without PAT/PMT and vlc wouldn't play sound on these - but mplayer or mpc on windows would.

I still haven't looked at how tvh makes these mkv, if it's ffmpeg then maybe someone on their list would know in what way they are broken. Of course it may not happen with current ffmpeg.

As I said before I made a mkv with current ffmpeg and -acodec copy and it worked. It was obviously different from the sample though in that the aac as broadcast is in latm and that was preserved in my test, but the aac in the sample is not in latm so something has changed it.

RE: Freeview HD audio drops - Added by Adam W over 4 years ago

Also having this same problem with some older MKV recordings in TVHeadend where the record started before the flick to AAC 5.1.

Can't find any way of decoding them/fixing the metadata so the audio gets decoded properly in VLC etc.

Although, by accident, I've found that in Windows 10 - Windows Media Player and the Films & TV apps will both play these files absolutely fine, with no glitch on the change from 2.0 to 5.1. Microsoft's AAC decoder obviously copes fine with the AAC LATM streams in the MKV container. It'd be good if there was a way to use the Microsoft codec to decode the files and re-encode maybe to AC3.

I also had a transport stream file I recorded from Freeview HD using VLC back in 2013, the 5.1 audio in this is also broken and no amount of transcoding in FFMPEG seems to fix this (even though it's TS not MKV). This also plays properly in the two Windows 10 apps after it's been remuxed to MKV without re-encoding the audio or video using FFMPEG, so the relevant AAC data must be there in the stream still somewhere that Microsoft AAC can interpret properly. The original TS file doesn't work in the Windows apps though bizarrely! (The stereo parts at the start and end will play, but the 5.1 of the programme is silent).

    (1-20/20)