[Not Hybrid related] MPEG-TS files with corrupt timestamps - Printable Version +- Selur's Little Message Board (https://forum.selur.net) +-- Forum: Talk, Talk, Talk (https://forum.selur.net/forum-5.html) +--- Forum: A/V Talk (https://forum.selur.net/forum-6.html) +--- Thread: [Not Hybrid related] MPEG-TS files with corrupt timestamps (/thread-1975.html) Pages:
1
2
|
[Not Hybrid related] MPEG-TS files with corrupt timestamps - antoniu200 - 30.08.2021 Hello! I have many MPEG-TS files that might contain corrupt timestamps. Meaning while I play the MPEG-TS file using MPC-HC or the PVR, the file plays through fine, but with simple audio and video bugs. If I try to re-encode the file using FFmpeg, Hybrid or tsMuxeR, I don't get any of the previous audio and video bugs, but rather the audio slowly goes out of sync from the video. Avidemux is the only tool that converts it correctly to mkv, but doesn't allow me to deinterlace the file. Is there any solution or FFmpeg command I can try and apply to keep the audio and video in sync? Here is a part of the TS file: https://drive.google.com/file/d/1hVzWIreu9N2Yoq5ER7kU5PBLHIL1B0ln/view RE: [Not Hybrid related] MPEG-TS files with corrupt timestamps - Selur - 30.08.2021 Moved the thread to the 'A/V Talk' section since it's not Hybrid related. In general: a. you should try remuxing the file with mkvtoolnix (it has some workarounds for some transportstream glitches) b. you could try Cypheros TS-Doctor or similar tools to fix the file c. ffmpeg and VLC usually can only help if there are just some slight problems with the headers Will look at the file today after work. Cu Selur RE: [Not Hybrid related] MPEG-TS files with corrupt timestamps - Selur - 30.08.2021 What I tried: a. remux with timecodes using Hybrid Hybrid:
Using mp4 I got a not playing file with audio&video in it. b. simple ffmpeg remux: ffmpeg -y -threads 8 -analyzeduration 200M -probesize 200M -i "C:\Users\Selur\Desktop\syncproblems_sample.ts" -codec copy -map_metadata -1 "E:\Output\ffmpeg.mkv" Remuxing the above file with Hybrid and the output is sync too. -> a simple remux with ffmpeg already seems to fix the issues. Cu Selur Ps.: btw. that video isn't really interlaced seems to be a mix of progressive and field shifted content. Loading the remuxed file and using 'Overwrite scan type to' 'progressive' and using 'Frame->Misc->TFM' seems to get rid of all the combing artifacts in the scenes that are not progressive. RE: [Not Hybrid related] MPEG-TS files with corrupt timestamps - antoniu200 - 30.08.2021 (30.08.2021, 05:55)Selur Wrote: Moved the thread to the 'A/V Talk' section since it's not Hybrid related. Understandable. Sorry for the wrong subforum. (30.08.2021, 05:55)Selur Wrote: In general: a. Tried, same as normal Hybrid or FFmpeg. Forgot to mention in the original message. b. Did not try. I know the program, I don't seem to be able to get around it very well. c. Makes sense. (30.08.2021, 15:20)Selur Wrote: What I tried: Tried that too myself. Same results. (30.08.2021, 15:20)Selur Wrote: b. simple ffmpeg remux: Then I really overcomplicated it. How come Hybrid can't remux it this way? I see one problem with this: it sets the overall framerate to 50 FPS, variable, which is incorrect. If I load the source in Hybrid and try and Bob it, it exports a 100 FPS file. While remuxing, it seems like FFmpeg ignores the "-r" flag. Commands I tried to use: ffmpeg -i d:\sample.ts -c copy d:\thing.mp4 ffmpeg -r 25 -i d:\sample.ts -c copy d:\thing.mp4 (30.08.2021, 15:20)Selur Wrote: Ps.: btw. that video isn't really interlaced seems to be a mix of progressive and field shifted content. Loading the remuxed file and using 'Overwrite scan type to' 'progressive' and using 'Frame->Misc->TFM' seems to get rid of all the combing artifacts in the scenes that are not progressive. Interesting, but Hybrid exports a 100 FPS file for me, in this case. I guess I'll just export & deinterlace them using FFmpeg. Update: thie file still doesn't have proper timestamps. I get this error in FFmpeg after trying to deinterlace the remuxed file. cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] Command used: ffmpeg -c:v h264_cuvid -deint 2 -i "d:\sample.mp4" -c:v libx264 -profile:v high -preset veryfast -crf 18 -x264opts "keyint=500" -c:a copy "d:\sample.mkv" RE: [Not Hybrid related] MPEG-TS files with corrupt timestamps - Selur - 30.08.2021 Quote:How come Hybrid can't remux it this way?Hybrid does extract the audio and video separately and not in one good. Which isn't a problem if the source hasn't any defects, but can cause problem on damaged content. (No Hybrid can't simply add this dehaviour, since it would require to rewrite tons of code.) Quote:While remuxing, it seems like FFmpeg ignores the "-r" flag.Probably since you only used it as input option. Instead of: ffmpeg -r 25 -i d:\sample.ts -c copy d:\thing.mp4 ffmpeg -i d:\sample.ts -c copy -r 25 d:\thing.mp4 Quote:Interesting, but Hybrid exports a 100 FPS file for me, in this case.you could also use "Filtering->SpeedChange->Change speed" to tell Hybrid to change the fps flag on the output. Quote:Update: thie file still doesn't have proper timestamps. I get this error in FFmpeg after trying to deinterlace the remuxed file. try with "-fflags +genpts -r 25" before the ' -i ': ffmpeg -c:v h264_cuvid -deint 2 -fflags +genpts -r 25 -i "d:\sample.mp4" -c:v libx264 -profile:v high -preset veryfast -crf 18 -x264opts "keyint=500" -c:a copy "d:\sample.mkv" Cu Selur RE: [Not Hybrid related] MPEG-TS files with corrupt timestamps - antoniu200 - 30.08.2021 (30.08.2021, 17:35)Selur Wrote: Hybrid does extract the audio and video separately and not in one good. I understand. (30.08.2021, 17:35)Selur Wrote: try with "-fflags +genpts -r 25" before the ' -i ': I think this works fine. I'll update once I have the full file, just to be sure no desync appears. As for the "-r" option, that only seems to not be ignored if I'm outputting to an mkv file. EDIT: Actually, the "-r 25" should not be applied to cuvid, since it will output a 25 FPS bobbed video, which is not ok. "-r 50" is the solution there, but I think it's better if I take it step by step: first remux with "-r 25", then deinterlace with "-r 50". I will try doing it from one go, only using "-r 50", as that will be quicker; and I'll let you know if that works as well. RE: [Not Hybrid related] MPEG-TS files with corrupt timestamps - antoniu200 - 30.08.2021 No, it doesn't work. Avidemux still reports the mkv file as having corrupt timestamps when trying to convert to mp4. Also, the audio slowly goes out of sync if re-encoded with cuvid & libx264. RE: [Not Hybrid related] MPEG-TS files with corrupt timestamps - Selur - 31.08.2021 Quote:No, it doesn't work. Avidemux still reports the mkv file as having corrupt timestamps when trying to convert to mp4.Even if you tell ffmpeg to generate new time codes (-fflags +genpts)? The fps isn't really an issue and can be changed during reencoding. If generating new time codes still doesn't help then using som repair software like TS Doctor or similar software. Cu Selur RE: [Not Hybrid related] MPEG-TS files with corrupt timestamps - antoniu200 - 31.08.2021 It actually seems to work, but only if the output container is mp4. With mkv, +genpts is ignored. It also seems to work all in one go, with the resulting mp4 file being 50 FPS constant, deinterlaced, in sync and valid timestamps - Avidemux doesn't complain anymore. I'll reupdate once I have the full file deinterlaced, as the sync issues can still appear later in the video. Command used: ffmpeg -c:v h264_cuvid -deint 2 -fflags +genpts -r 50 -i "d:\original.ts" -c:v libx264 -profile:v high -preset veryfast -crf 18 -x264opts "keyint=500" -c:a copy "d:\original.mp4" RE: [Not Hybrid related] MPEG-TS files with corrupt timestamps - antoniu200 - 31.08.2021 It works, but only if done step by step: first - a simple remux; command I used: ffmpeg -fflags +genpts -i "d:\original.ts" -c copy "d:\original.mp4" This will create a 50 FPS file, with fixed timestamps. Then, a re-encode: ffmpeg -c:v h264_cuvid -deint 2 -i "d:\original.mp4" -c:v libx264 -profile:v high -preset veryfast -crf 18 -x264opts "keyint=500" -r 50 -c:a copy "d:\original1.mp4" This will output a constant 50 FPS file, deinterlaced, with audio in sync with video. I'm going to try and find a command that tells FFmpeg to do both of these things in one go. |