View Full Version : Can ffmpeg remux h264 while skipping bad frames?
shae
22nd February 2020, 02:27
Whether the problem is the raw h264 or the container frames, and ideally recovering as much as possible.
I thought maybe -err_detect can help, but it just allows everything through.
Selur
22nd February 2020, 15:40
in short: no
shae
22nd February 2020, 16:13
Any other tool that can help?
I have a video that mostly plays fine, but with a few bad spots that cause a freeze for a few seconds each. I'm hoping to cut out these, without reencoding.
Selur
22nd February 2020, 16:28
If you don't cut out whole groups of pictures (gops) you won't get around reencoding and depending on the source gops are usually not that short that cutting would not go unnoticed.
shae
22nd February 2020, 18:05
It will surely be noticed, but after a broken segment I want to keep everything starting from the next semi-valid delta frame.
Anyway, turns out it can be done with Avidemux (though manually).
For each good segment I set markers and direct-copied to a new file, then finally joined them all.
Apparently copying raw frame data as-is is possible even when the range markers are on non-I frames.
And a correction: it actually wasn't H264, it's MPEG4 part 2, maybe ASP.
StainlessS
22nd February 2020, 19:43
I believe that Avidemux will re-encode just the partial decoded gops [also same for old MPeg2Cut2 and mpg2 files, long time since I used either one].
shae
23rd February 2020, 21:08
I used "Copy" mode, so no reencoding. It seems to have copied also delta frames in the starts and ends, according to the set range markers.
manolito
25th February 2020, 11:03
I believe that Avidemux will re-encode just the partial decoded gops [also same for old MPeg2Cut2 and mpg2 files, long time since I used either one].
Sorry, no, this is not true in both cases... :devil:
Neither AviDemux nor Mpeg2Cut2 can perform "Smart Rendering", i.e. just reencode the GOP where a cut point is requested.
For MPEG2 the only free smart render solution is still Cuttermaran. And for H264 clips I am not aware of any free tools which can do this.
A lot of commercial video editors like the offerings by Magix, Cyberlink, Pinnacle, Pegasys and others claim that they can do smart rendering for H.264 and even H.265, but several test reports revealed that this is not really true.
For cutting H.264 clips at key frames there are several free solutions, but the only half way working solution for cutting at random frames is VidCutter. Looks like it has been abandoned, but I find it very useful. It works better with MP4 containers than with MKV, and it really helps to replace the included FFmpeg version with a current version.
StainlessS
25th February 2020, 11:52
For MPEG2 the only free smart render solution is still Cuttermaran.
Yep, thats right, I confused it with Mpeg2Cut2, (Cuttermaran, although I thought it was CutterMan, I even have it in a directory called CUTTERMAN).
Thanx Mani.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.