Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Capturing Video

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th October 2018, 20:54   #1  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,513
Trying to reencode a captured video, don't know what I'm doing...

I've just recorded Doctor Who on BBC1 HD off Freeview using some cheap USB Freeview/capture stick I got a while ago. This gives me a .mpg file.

I want to trim off the start and end and reencode the audio only - it's currently AAC and I want AC3 (Dolby Digital).

The .mpg plays fine in MPC-HC and VLC, but any encoding I try to do with ffmpeg from it just gives me a lod of "Invalid DTS" and "Invalid timestamp" messages.

So I tried dragging it into DGIndexNV so I could trim it a bit and "Output Trimmed TS". This gives me a TS file which also plays fine in MPC-HC and VLC.

But when I try to reencode the trimmed TS file, firstly i get a few dozen "DTS discontinuity" errors from ffmpeg, then if I try to output an MKV it keeps saying "Starting new cluster due to timestamp." If I output an MP4 it doesn't give this error, but the file plays back very poorly in VLC and MPC-HC - full of stutters. Loading the MP4 into VirtualDub2, it looks like there are load of black frames dropped into the video.

Can anyone give me some ideas on a) other ways to handle such an input or b) how to cut a bit of the original .mpg to upload somewhere so someone can take a look at it? Or c), some suggestions for decent capture software and not this weird "Total Media" thing that came with the stick?
__________________
My AviSynth filters / I'm the Doctor
davidhorman is offline   Reply With Quote
Old 14th October 2018, 22:42   #2  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Posts: 2,301
If your USB capture stick produces an .mpg file does this mean that the BBC broadcasts the HD content as HD MPEG2, or does the capture stick (with the help of the included capture software) reencode to MPEG2 on the fly during capturing?

If the capture is reencoded on the fly then I think you can get better results skipping the real time conversion to MPEG2 by using VDub for capturing in the native broadcast format (most likely AVC/AAC in a TS container).

If the BBC really broadcasts in HD MPEG2 then maybe you can specify the output container to be .ts instead of .mpg. In any case you will always get such ffmpeg errors during encoding of broadcast MPEG2 content. The only reliable solution for me has always been to convert TS to PS using software like ProjextX. This will demux the source while correcting all these timing problems.


Good luck
manolito

//EDIT//
For repairing .ts files from a broadcast there is a tool called TSDoctor (they have a 30 days trial period). It does not always fix all the errors, but worth a try...

Last edited by manolito; 14th October 2018 at 22:54.
manolito is offline   Reply With Quote
Old 15th October 2018, 19:32   #3  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,513
It's video is H.264/AVC. My USB stick just puts .mpg on whatever it records. I'd previously tried Windows Media Center or whatever it's called but it uses it's own weird format which I couldn't find anything to read. My previous use of these files was to reencode them via DGIndexNV which always worked fine, but trying to remux without reencoding is proving to be problematic.

I think it may just be an FFMPEG issue. There's something about the BBC's video streams it just doesn't like - illegal picture references, problems with timestamps, and so on. The source files all play fine, though.

I've now used DGIndexNV to trim and demux, ffmpeg to reencode AAC to AC3, manual cutting of the AC3 to sync, and MKVToolNix to mux. It seems to work, except that ffmpeg complained about some errors in the AAC stream and the audio drifts out of sync, so it probably just dropped the bad parts.
__________________
My AviSynth filters / I'm the Doctor
davidhorman is offline   Reply With Quote
Old 15th October 2018, 19:37   #4  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Posts: 2,301
Could you upload a short sample?
manolito is offline   Reply With Quote
Old 15th October 2018, 20:12   #5  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,513
These are some trimmed TS files output by DGIndexNV:

http://horman.net/switch.ts
http://horman.net/titles.ts

The first file is the very start of my recording, which includes a switch in the main audio track from stereo to 5.1.

The second file starts further along, so the main audio track is only 5.1.

Both have a second audio description track and some subtitle streams.
__________________
My AviSynth filters / I'm the Doctor
davidhorman is offline   Reply With Quote
Old 15th October 2018, 22:55   #6  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Posts: 2,301
Thanks for the samples...
The format is very similar to the German public DVB-T2 format (with the exception that they always broadcast at 50 fps here). Even the dreaded AAC-LATM audio is there.

Quote:
Both have a second audio description track
For the first "switch.ts" sample I cannot see a second audio description track. This file does cause trouble here, it does not play nicely in any of my software players. TSDoctor cannot even analyze it correctly, the start PCR is wrong, the user is told to repair the stream first (but no mention of how to do this).

The other file "titles.ts" does work. TSDoctor does not find anything to repair, it just strips padding. You only get all these errors if you try to use FFmpeg on the file directly. I found that you always should repack such streams first to MKV using MKVToolNix. If you feed such MKVs to FFmpeg there will still be some messages: "Non-monotonous DTS in output stream", but all the other errors have disappeared.

I converted this MKV with FFmpeg using "Copy" for the video and the subs, and converting both audio tracks to AC3. You can check it out here:
https://www.sendspace.com/file/qdrjip

With this sample it is hard to tell if audio is completely in sync, but it looks good to me. Please note that with such AAC-LATM source audio you will get huge audio delays of sometimes more than 1 sec. This can cause trouble if you need to decode the file depending on the source filter. With ffms2 and also with DSS2Mod this audio delay needs to be ignored.


Cheers
manolito
manolito is offline   Reply With Quote
Old 15th October 2018, 23:30   #7  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,513
I used MKVToolNix as you suggested. Then I ran ffmpeg, and it did come up with a few DTS errors at the start, and a lot at the end, but otherwise it seems to have worked! The audio stays in sync the whole way through.

The only remaining issue it that both VLC and MPC-HC have trouble playing the end credits, which are the only part of the video which is interlaced. Both players deinterlace by default, but the credits stutter. When I load it into VirtualDub2, it identifies a lot of frames (which it fails on/displays as dupes of the last good frame) in the credits as [+] type, (instead of P, B, I, or K).

Here's a short sample, if you want to take look:

http://horman.net/credits.ts

It includes a bit of the final scene which should playback okay before the credits start. I haven't included the whole credits, but as soon as the interlaced text disappears off the top of the screen, the background swirl plays normally again, as does the whole "Next Time" teaser. I guess i could reencode the credits and join them on, but I also can't guarantee there aren't such "bad" frames elsewhere in this or any other episode.

Thanks for your help!
__________________
My AviSynth filters / I'm the Doctor
davidhorman is offline   Reply With Quote
Old 16th October 2018, 02:32   #8  |  Link
videoh
Registered User
 
Join Date: Jul 2014
Posts: 563
Must be a player issue. Looks great playing this in VDub2 or MPC-HC:

loadplugin("dgdecodenv.dll")
dgsource("C:\Users\Don\Downloads\credits.dgi",deinterlace=1)

There don't appear to be any "bad frames".
videoh is offline   Reply With Quote
Old 16th October 2018, 05:55   #9  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Posts: 2,301
No idea about the "credits.ts". I also cannot get the credits to scroll smoothly here, no matter which player I use. The weird thing is that the TS file is 25 fps, but after repacking it to MKV with MKVToolNix the rate is 43,425 FPS VFR. And trying to remux it to MKV with FFmpeg does not work at all.

But of course I do not have DGDecodeNV, you probably should use this...
manolito is offline   Reply With Quote
Old 21st October 2018, 16:51   #10  |  Link
gonca
Registered User
 
Join Date: Jul 2012
Location: Scarborough, Canada
Posts: 815
Out of curiosity I repacked the credits.ts file to mkv and it retained the 25 fps setting, but marked it as variable
gonca is offline   Reply With Quote
Old 25th October 2018, 20:03   #11  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,513
It seems to cause problems with VLC, MPC-HC, VirtualDub2, and possibly ffmpeg itself - whether it's in MKV or TS - but happily it doesn't affect my TV, apart from perhaps a very slight stutter on the transition.

So I use DGIndexNV to output a trimmed TS, use MKVToolNix to repack it to an MKV, then use ffmpeg to reencode audio only to AC3.
__________________
My AviSynth filters / I'm the Doctor
davidhorman is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 17:50.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.