0

Um, so I'm trying to use ffmpeg to convert my mp4 videos to a smaller format like mov or flv because mp4s are just way too big and the videos are just backups.

I tried swapping my container to mov using this in the windows run command (which is how I think it's supposed to be done, none of the tutorials I read actually said that though I'm kinda guessing) :

ffmpeg -i Sekiro 3.mp4 -c copy Sekiro 3.mkv

But nothing is happening. I feel like I am doing something wrong but I can't even begin to figure out what that is. I did do the steps to get it installed and I'm pretty sure I'm missing how to get ffmpeg to find the video file.

Does it have a popup or something so I can see if it's working? I'm at a loss here.

6
  • 1
    See video.stackexchange.com/q/20495 – Gyan Apr 19 '19 at 13:01
  • 2
    You should have a look at: superuser.com/questions/300897/… — just changing the container isn't going to give you smaller files. You have to re-encode your video. And what do you mean by "nothing is happending"? Did you just enter that into the "Run" dialog, or did you open a command prompt before (you should do the latter)? – slhck Apr 19 '19 at 13:15
  • I realized I needed the cmd window. I wish the tutorials I read actually mentioned this. I have little to no coding knowledge I just need these videos smaller. I would prefer flv file type if at all possible. – naobilynn Apr 19 '19 at 13:21
  • Why would you need FLV? This is an old and rarely used container. (Please reply with @slhck so I get notifications, thanks) – slhck Apr 19 '19 at 13:23
  • @slhck It's what my obs puts them to automatically. I can remux them to mp4 at any time. But I edited some of them so I have these big mp4 files taking up my hard drive. I just want them smaller and all the same file type so I can neatly tuck them in a folder and not have them take up 400 GB of space. And I just realized flv isn't any smaller. I'm sorry. I'm not super savvy with this kind of thing. – naobilynn Apr 19 '19 at 13:27
2

There are some wrong assumptions in your question:

  • Please first read about the difference between codecs and containers.

  • You say you want to save space by re-encoding a video, but your command only copies the video bitstream to another container ("format" in FFmpeg terms) since it uses -c copy. In order to get a smaller file, you have to re-encode the video (and maybe audio) stream.

  • To re-encode the video stream so, change -c copy to -c:v libx264, which would re-encode your video using an H.264 encoder. To control the size and quality, use the -crf 23 option. By default, its value is 23; lower values will be higher quality, and vice-versa. Useful range is 18–28, depending on how much you want to save. You can read more about CRF encoding here. A CRF of ±6 gives you roughly half or twice the file size.

  • The output container does not really matter; it's not going to change the file size considerably. Matroska (MKV) is a modern container that supports basically any codec type. Choose this if you don't know what else to use.

  • When running an ffmpeg command from Windows, you'll first have to open a command prompt. Then run the command from there. A good tutorial on running FFmpeg under Windows was linked to by Gyan above.

  • When using files with spaces in their name, you have to quote them. For example, a file called foo bar.mp4 would be interpreted as two files, one called foo and one called bar.mp4. This is obviously not what you want.

To summarize, you command then becomes:

ffmpeg -i "Sekiro 3.mp4" -c:v libx264 -crf 23 -c:a copy "Sekiro 3.mkv"

The -c:a copy part says: copy the audio stream. If this results in a too large file, you could increase the CRF to 28, for example.

4
  • Do I need to tell the program where the file is? That other poster said something about cd [path] but it's not there anymore so do I not need it? – naobilynn Apr 19 '19 at 13:35
  • Yes, you either need to be in the right directory or give the full path to the files. This is a little basic, so I recommend you to invest a few minutes and read up on a tutorial about using the command prompt. – slhck Apr 19 '19 at 13:36
  • I did it. I found a site that told me how to have the cmd prompt start with the correct path and entered what you told me and now it's working. I'm so happy I could cry. I've been at this for 5 hours so thanks so much. – naobilynn Apr 19 '19 at 13:57
  • @naobilynn Thank you for confirm this answer worked out for you. Please consider cliking the check mark next to the answer, which will let people know that it worked for you. – AlexLoss Apr 19 '19 at 21:38
1
  1. Be careful with your use of spaces in the command line. They are used to separate arguments for the interpreter (a process called "parsing").

    If your file has spaces in its name, you should 'escape' them, by using a \ (backslash), so your command should look like this:

    ffmpeg -i Sekiro\ 3.mp4 -c copy Sekiro\ 3.mkv
    
  2. According to the manual page of ffmpeg

    codec is the name of a decoder/encoder or a special value "copy" (output only) to indicate that the stream is not to be re-encoded.

    So from what I gather, it is not changing anything to your file, unless you add other -c options as explained in the manual :

    -c[:stream_specifier] codec (input/output,per-stream)

    -codec[:stream_specifier] codec (input/output,per-stream)

    Select an encoder (when used before an output file) or a decoder (when used before an input file) for one or more streams. codec is the name of a decoder/encoder or a special value "copy" (output only) to indicate that the stream is not to be re-encoded.

    For example

    ffmpeg -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT

    encodes all video streams with libx264 and copies all audio streams.

    For each stream, the last matching "c" option is applied, so

    ffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT

    will copy all the streams except the second video, which will be encoded with libx264, and the 138th audio, which will be encoded with libvorbis.

    You can get a list of available codecs, encoders etc. by using ffmpeg -codecs orffmpeg -encoders. You should then consider switching copy into the desired codec output.

    As explained in this post:

    MP4 and MOV are just containers that have an audio and a video stream inside them.

    You have to actually change the encoder to see a change in file size. Somebody more experienced could tell you which one to use.

4
  • Your link at the end is misleading. The command just shows how to change the container while copying the video streams. This isn't going to get the OP a smaller file. – slhck Apr 19 '19 at 13:16
  • I figured spaces in the files had something to do with what was going wrong. – naobilynn Apr 19 '19 at 13:19
  • @slhck Given that the mov format is just a container, I thought it would help to clarify that you have to actually change the encoder in order to see any benefit. Should I emphasize it in the answer? – AlexLoss Apr 19 '19 at 13:20
  • @slhck Thank you for that answer. (and for looking my other posts up :) – AlexLoss Apr 19 '19 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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