Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know a little about video editing, and how keyframes work and how important they are.

My question is this: I need to cut part of a video out with precise edits in-between. I know I can easily make a 'rough cut' around the clip with VirtualDub and the keyframe selector, but I also need to cut very short (sometimes 1-2 secs) changes within the clip. And, unfortunately, some of those frames happen to be key ones.

How do I deal with this? Can I transform all frames into keyframes in some sort of uncompressed format, make my edits, and then re-encode it to put the keyframes back automatically? I read somewhere that it was possible to save all frames as jpeg, and then combine them into a video again. That might work, too. I would like to leave it as lossless as possible,

share|improve this question
up vote 0 down vote accepted

How do I deal with this? Can I transform all frames into keyframes in some sort of uncompressed format, make my edits, and then re-encode it to put the keyframes back automatically?

Yes. Ideally you'd convert your original video to a lossless or visually lossless intermediate codec. Some of the options you have are:

  • HuffYUV (lossless)
  • Apple ProRes (visually lossless)
  • Avid DNxHD (visually lossless)

For the former you could use ffmpeg and just call the following command. Most editing software on Windows should be able to read the file.

ffmpeg -i input.mp4 -c:v huffyuv output.avi

If that doesn't work for you, you could also create MJPEG video – it's really just a sequence of JPEG-encoded images. So of course, you want to keep the quality as high as possible:

ffmpeg -i input.mp4 -c:v mjpeg -qscale:v 0 output.avi

Note that in the above examples the audio will be re-encoded automatically to MP3. Depending on your workflow you might want to disable audio altogether (-vn) and later copy it from the original using a video editing program.

share|improve this answer
    
Yes, that worked beautifully. What would you do to re-encode? Same bitrate and settings as the old? – Gatekeeper Jan 22 '14 at 2:59
    
It depends on what your goal is—do you need long term, high quality storage or small but good quality web video? Typically you want to encode to H.264 these days. With ffmpeg that'd be something like ffmpeg -i input.mp4 -c:v libx264 -crf 23 -c:a aac -strict experimental -b:a 128k, where CRF is the quality parameter of the video stream. See: trac.ffmpeg.org/wiki/x264EncodingGuide – slhck Jan 22 '14 at 9:11
    
Oh, it's just for personal usage. Forgot to mention that. I was going to dig into the ffmpeg command-line reference but opted to use WinFF with the latest build, instead. – Gatekeeper Jan 22 '14 at 16:29
    
I don't understand terms like visually lossless. If you re-encode something many times with a 'visually lossless' codec, you will still suffer visible loss right? So it's a misnomer. – jiggunjer Dec 19 '15 at 18:39
    
@jiggunjer Yes, this may happen, but only if you're doing it "many times". This is usually not the case: Visually lossless intermediate codecs are used for editing and temporary storage and not for further processing. – slhck Dec 21 '15 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .