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. |
18th April 2018, 17:01 | #1 | Link |
Registered User
Join Date: Sep 2013
Posts: 22
|
Cut beginning of h264 video with minimal re-encoding?
Ffmpeg makes it super easy to losslessly cut off the end of an existing h264 stream: you just use -codec copy alongside -t or -to to specify how long you want the clip to be.
Cutting off the beginning of a stream with -ss, however, does not work so well. I always end up with a corrupted second or two of video at the beginning of the resulting clip. I understand why this is—h264 frames cannot exist independently, as they rely on information from previous frames. As a result, some frames will always have to be re-encoded—but I should be able to avoid re-encoding everything, right? How can I cut a portion from the beginning of an h264 stream while re-encoding only the minimum number of frames required? I would prefer to do this via ffmpeg, if possible Thanks! |
18th April 2018, 22:15 | #2 | Link |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
According to the documentation ffmpeg is supposed to seek to keyframes so corruption isn't supposed to happen. Try latest version and if that doesn't work make a bug report. But maybe that is a limitation with OpenGOP style encodings. I do not know. ffmpeg doesn't support automatic "smart" encoding where only the affected GOP is re-encoded and the rest is copied.
There are other softwares for that: SolveigMM Video Splitter, VideoReDo, Selur's "MKV Cutter" and probably a hand full of others I forgot about. |
20th April 2018, 15:58 | #3 | Link | |
Registered User
Join Date: Sep 2013
Posts: 22
|
Thanks for that link. I'd seen it before but a very long time ago. Reading through, I might I misinterpreted my problem:
Quote:
Is there a way to tell ffmpeg to not include audio only at the beginning? |
|
20th April 2018, 16:17 | #4 | Link |
Registered User
Join Date: Dec 2005
Location: Germany
Posts: 1,795
|
If you want a GUI for cutting use http://avidemux.sourceforge.net/
You can jump to next keyframe (IDR) and cut without re-encoding.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth VapourSynth Portable FATPACK || VapourSynth Database |
23rd April 2018, 14:19 | #6 | Link |
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
|
If key frame accuracy is not enough, there are not many free choices. Solveig and VideoRedo are commercial. The only free offerings for frame accurate cutting I have found are MKVCutter by Selur and the current versions of VidCutter. I have not tested them, but they sure look promising...
Cheers manolito |
Thread Tools | Search this Thread |
Display Modes | |
|
|