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.

AlexLoss
  • 274
naobilynn
  • 1
  • 2

2 Answers2

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.

slhck
  • 235,242
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.

slhck
  • 235,242
AlexLoss
  • 274