2

I'm making the 3rd instalment of my Sand Wars series (Sand Wars II) and I shot the majority of my footage at 60p (which I think means 60fps and progressive rather than interlaced). I do not want to rotoscope lightsabers 60 frames per second and would much rather do 30. The footage is currently at 59.94, which I think is close enough to 60. I know I can lower the frame rate using HandBrake, but I don't want to have to lose more quality than I already will, as each clip is probably going to be run through Blender a few times. What settings can I enable on HandBrake to take an entire folder of my footage (I don't want to have to do this hundreds of times for each video file) and output it into another folder with each video having a frame rate of 30 fps (or 29.97) with as little quality loss as possible?

Thanks, Anson

2
  • 1
    I think you're probably pushing Handbrake further than it was designed to go. I'd suggest using ffmpeg - it's the right tool for the job. ffmpeg -i input.mp4 -preset ultrafast -crf 0 -r:v 30 -c:a copy output.mp4 will do a lossless h.264 encode of your footage at 25fps. You could also use another codec, h.264 can be dodgy for editing. For example prores: ffmpeg -i input.mp4 -c:v prores -profile:v 3 -c:a pcm_s16le -r:v 30 output.mov.
    – stib
    Commented Jul 9, 2016 at 14:27
  • @stib Sounds cool! I am not sure how to do anything like that (I probably sounded like I know more than I do). If you could put some instructions in an answer, that would be great! Commented Jul 9, 2016 at 15:21

1 Answer 1

4

FFMPEG is probably a better tool for the job, if you are prepared to deal with the command line. Install ffmpeg from the packages found here. These are all ready-built and should have all the included libraries you need.

Once you've installed ffmpeg you will need to run it from the command line. Since there's different ways of doing that depending on your platform, the one safe bet is that if you drag the ffmpeg icon into the command line window you should get the path to the ffmpeg executable auto-filled for you. Next you type out a command like this:

<ffmpeg executable path> -r 60 -i <input path> -preset ultrafast -crf 0 -r 30 -c:a copy <output path.mp4>

for a lossless mp4 file or

<ffmpeg executable path> -r 60 -i <input path> c:v prores -profile:v 3 -r 30 -c:a copy <output path.mov>

for a prores encoded quicktime file (ffmpeg will encode prores on Windows and Linux, but whether ProRes is readable depends on what software you're editing on. Alternatives are DNxHD/DNxHR and Cineform, but that's beyond the scope of this answer).

In both instances the <ffmpeg executable path>, <input path> and <output path.mp4> means the path to the respective files, i.e. what you get when you drag them into the terminal. So to fill out the path to the input file, just drag it into the terminal. Since the output file doesn't exist, copy the input file and change the name and extension to whatever you want. On Windows it will be something like "c:\users\stib\folder\another folder\movie1.mp4" on a mac it will be /Users/stib/folder/another\ folder/movie1.mp4 Linux will be similar to mac (though the home folder will vary depending on your distro. But anyway…).

The first example use h.264 compression with the Constant Rate Factor -crf (inverse of quality) set to 0 or lossless. Since you're not looking for small file sizes the preset is set to ultrafast and the audio codec -c:a is set to copy (this is assuming you're using an mp4 as input) so that the audio will not be re-encoded.

The second uses prores compression with the -profile:v 3 setting it to ProRes HQ, a very solid codec for editing work on Macs or Windows machines using Adobe Premiere. You could change this to Avid DNxHD or other codecs of your choice, with ffmpeg there are literally hundreds to choose from.

In both examples I changed the video frame rate using -r 30, this will drop input frames to output a constant 30fps. Since your input is 59.94fps.

I also used -r 60 before the -i input flag to force ffmpeg to treat the input file as 60fps (although it doesn't add or remove frames, just changes the way they are interpreted). You could instead change your output to 29.97 fps by using -r 30000/1001 instead of -r 30 for the output, and not bother putting a -r rate flag before the input.

Applying this to a whole folder of files involves using the shell. How you do that depends on your OS.

on a Mac or Linux machine, here's one way

cd "/path/to/my folder of media/"
mkdir "30FPS_converted"
for i in *.mov; do
ffmpeg -i $i <ffmpeg options here> "./30FPS_converted/${i/mov/mp4};"
done
  1. change directory to the folder using the cd command, e.g. cd "/Users/stib/my media/folder1" once again, you can drag the folder onto the terminal window.
  2. Create a new directory for your output files with the mkdir command (or do it in finder / file browser of your choice.
  3. create a loop with the contents of the folder using the for command, and use that to provide the input for the ffmpeg command. The command above creates a list of all the files with the suffix ".mov", creates a variable $i and every time the loop goes round it changes the value of $i to the next file in the list. The ${i/mov/mp4} is called brace substitution. It substitutes the letters "mov" in the value of $i with the letters "mp4"

On Windows here's how you'd do it with Powershell (you could do it it with batch scripting, but I refuse to learn batch scripting):

set-location "c:\Users\me\my media files\"
new-item "30FPS_converted" -type directory
get-childItem*.mov | foreach {
ffmpeg -i $_ <ffmpeg options here> (".\30FPS_converted" + $_.name.replace("mov", "mp4))}
  1. change directory to the folder using the Set-Location command (though usually cd works too), e.g. Set-Location "C:\Users\stib\my media\folder1" once again, you can drag the folder onto the terminal window.
  2. make a new directory using the new-item command (mkdir usually works too). In the example above the path for the output folder is . (a full stop), this means "the current directory"
  3. list the files in the folder (get-childItem, though usually ls works too) that end with the suffix you're after, and pipe | the output to a foreach loop. Inside that loop the variable $_ takes on the value of the file objects in the list one by one. Then use the name.replace() function to create the appropriate output name, and append that to the directory name.

Obviously if your source files aren't .movs you change the .mov bits in the command to whatever you've got, and the same for the output file extension.

3
  • Awesome! Can this take a whole folder of video as input? Commented Jul 9, 2016 at 17:09
  • For 29.97, it's better to represent r as 30000/1001.
    – Gyan
    Commented Jul 9, 2016 at 17:10
  • Oh, and you can skip the :v after -r. Unlike, -b , -r is taken to refer to video.
    – Gyan
    Commented Jul 9, 2016 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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