On the last episode of the Ask Noah Show, Noah mentioned that he had an FFMpeg script that he used to convert MKV files ripped from BluRay into a more manageable file size while still retaining quality. It’s in the show notes here (https://podcast.asknoahshow.com/151) and I’ll post below. Would anyone mind walking me through how to use it? I’ve never actually used a script on Linux before and wanted to give this a shot.
This is it:
ffmpeg -y -i input.mov -pix_fmt yuv420p -c:v libx264 -preset medium -b:v 700k -pass 1 -threads 12 -an -f mp4 /dev/nullSecond Pass
ffmpeg -i input.mov -pix_fmt yuv420p -c:v libx264 -preset medium -b:v 700k -pass 2 -threads 12 -c:a libfdk_aac -b:a 192k output.mp4
How much do you know about running commands in the terminal?
Instructions here should be pretty straightforward, unless you never worked in a terminal before. But we can walk you through the process.
input.mov with path to your file. Also
/dev/nullSecond Pass should be just
/dev/null. Other than that you just run the commands.
Unfortunately, I haven’t listened to the episode yet, so I’m not sure on the details.
That was what I tried first. However, when I try that the following occurs: rather than anything occurring, the character “>” is displayed underneath the command. I can type, but nothing else happens. If I press enter again, another > appears below the first.
Most likely means you have an unterminated quote somewhere. (started a " but did not close it?). Alternatively, perhaps you put a ‘\’ instead of a ‘/’ in a path? The ‘\’ character tells bash to continue to the next line.
Just for correctness, ‘\’ is actually the “escape” character. When placed before the end of a line, it continues to the next line (i.e., escapes the newline).
There are no quotation marks or back slashes in the command I’ve attempted to run on my terminal
But now something appears to be happening if I put the path in quotations. I’ll update you.
OK so I’m making some progress. Near as I can tell, the “First Pass” definitely worked, however, I’m not sure where the resulting file was output to. Just for the heck of it, I ran the “Second Pass” on the same file that I ran the first pass on (though I assume I would instead run it on the result of the “First Pass” when I find it. That however, results in an output of “Unknown encoder ‘libfdk-aac’”
Any ideas on how to find my first file and successfully run the second pass?
Can you paste your exact command here?
Also what distro/version are you on? I believe that is the “Fraunhofer” AAC codec which would only be in non-free repos.
actually, shouldn’t it be “libfdk_acc”? <-- underscore not dash
I’ve tried both underscore and dash, and both produce the same output respective to the two characters. I’m using Manjaro.
My “First Pass” command would be the following:
ffmpeg -y -i “/home/chasb/Downloads/It’s the Great Pumpkin, Charlie Brown.mkv” -pix_fmt yuv420p -c:v libx264 -preset medium -b:v 700k -pass 1 -threads 12 -an -f mp4 /dev/null
In pass 1 and 2, use the -pass 1 and -pass 2 options, respectively.
In pass 1, output to a null file descriptor, not an actual file. (This will generate a logfile that ffmpeg needs for the second pass.)
In pass 1, you need to specify an output format (with -f) that matches the output format you will use in pass 2.
In pass 1, you can leave audio out by specifying -an. ```
Hmm. So I guess I just need to figure out the libfdk-aac issue then? Because the first pass isn’t generating a new file so much as it’s generating the information the second pass needs to create a new file?
Yes, that sounds correct. I will have to defer to someone else as I have never used Majaro or Arch. I’m guessing you need to build the required package but I don’t know what it’s called or how to do that on Manjaro sorry.
pacman -S gst-plugins-bad
should cover it all (not on arch/manjaro atm)
Gave it a go but that package is already installed
I followed your steps but on Ubuntu, get the same error. Searching for “Unknown encoder ‘libfdk_aac’” I see this forum entry and wonder if that’s the problem. I’m not good enough to compile it with this entry in there.
Did you get yours working?
Should have posted, Noah suggested a new encoder that worked for me. Try this:
ffmpeg -y -i input.mov -pix_fmt yuv420p -c:v libx264 -preset medium -b:v 700k -pass 1 -threads 12 -an -f mp4 /dev/null
ffmpeg -i input.mov -pix_fmt yuv420p -c:v libx264 -preset medium -b:v 700k -pass 2 -threads 12 -c:a libvorbis -b:a 192k output.mp4
Awesome, thank you! I don’t know what the encoders are, I just want backups of my physical disks. This did great until I ctrl+c’d it. I’m re-running now, but it is running, so thank you for the corrected code and fast reply!