Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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 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 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 at 16:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.