How do I specify ffmpeg video directory?
Solution 1
You can tell ffmpeg where to look for files
If you are launching `ffmpeg from the terminal, you will need to either change directory to the location of the video you would like to work on, or specify the full path.
Getting the file location
I have a video in a folder in my movies folder called test.mp4 but when I try to use ffmpeg to convert it by typing 'ffmpeg -i test.mp4 test.avi' it keeps telling me 'No such file or directory' it does the same thing when I try it with other videos. The videos are definitely there though.
If Finder, you can hit Cmd+C on the directory you have your movies in, as if you were going to copy it. You can then hit Cmd+V in the terminal to paste that directory's path (where it is found on your Mac).
Then use the cd
command to change to that directory:
cd /Users/Arron/Movies/
and redo your ffmpeg command:
ffmpeg -i test.mp4 test.avi
Alternatively, you could specify the full path to both the input and output files:
ffmpeg -i /Users/Arron/Movies/test.mp4 /Users/Arron/Movies/test.avi
It would be worth reading up on the ffmpeg documentation to learn about what the command you are doing does, as it may not be what you expect.
Solution 2
When you open a terminal and you're referring to a file name, the shell looks for the file relative to your working directory.
To see your working directory, enter:
pwd
To change to another working directory, enter cd
. So if your file is in the folder ~/Downloads/videos
, run:
cd ~/Downloads/videos/
You can also drag the file from your Finder to the terminal, that is, if you type:
ffmpeg -i __
^---- your cursor is here
Then you can drag and drop the file to where your cursor is, and it will automatically add the full path to the file.
Related videos on Youtube
Arron
Updated on September 18, 2022Comments
-
Arron almost 2 years
I'm sure this is a very basic question so I apologise but I couldn't find it being asked on here before.
I've just downloaded and installed ffmpeg for Mac OSX and the main thing I want to use it for is converting files like AVIs or MP4s into MOVs or reducing the frame rate or resolution.
I have a video in a folder in my movies folder called test.mp4 but when I try to use ffmpeg to convert it by typing 'ffmpeg -i test.mp4 test.avi' it keeps telling me 'No such file or directory' it does the same thing when I try it with other videos. The videos are definitely there though.
So is there a specific folder I need to put the videos into, like an input directory or is there a way in the command line that I can specify the folder the video is in?
Thanks in advance!
-
Arron over 5 yearsAmazing, thank you for that, now I've told it where to look it's worked straight away. I'll look through the documentation as well though like you say just to make sure I understand what's actually being done. Thanks!
-
Arron over 5 yearsThank you for the swift reply, I'm now specifying the full file directory for now but it's good to know how to change the working directory when I need to. thanks!
-
slhck over 5 years@bertieb The user can't upvote answers due to the lack of reputation.
-
bertieb over 5 years@slhck Oh, I thought you could always comment/vote on As to your own Qs; good to know!
-
Ryan over 4 years+1 Do either of you know how to fix EXT-X-MAP:URI in m3u8 when specifying absolute hls_fmp4_init_filename using ffmpeg? Using absolute directory like you suggested isn't working. stackoverflow.com/q/60460212/470749 Thanks.