ffmpeg - Converting MOV files to MP4
196,848
The command to just stream it to a new container (mp4) needed by some applications like Adobe Premiere Pro without encoding (fast) is:
ffmpeg -i input.mov -qscale 0 output.mp4
Alternative as mentioned in the comments, which re-encodes with best quaility (-qscale 0
):
ffmpeg -i input.mov -q:v 0 output.mp4
Related videos on Youtube
Author by
user1503606
Updated on October 11, 2020Comments
-
user1503606 over 3 years
I have just installed ffmpeg and I am trying to encode all my uploaded videos to .mp4 file. Most of the users currently upload .mov and I want to convert every video to .mp4.
I am running the command as follows:
ffmpeg -i movie.mov -vcodec copy -acodec cop out.mp4
But all I am getting is the following errors
ffmpeg version 0.8.5, Copyright (c) 2000-2011 the FFmpeg developers built on Aug 19 2012 11:38:20 with clang 3.1 (tags/Apple/clang-318.0.61) configuration: --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libfaac --enable-libxvid --enable-libx264 --enable-libvpx --enable-hardcoded-tables --enable-shared --enable-pthreads --disable-indevs --cc=clang libavutil 51. 9. 1 / 51. 9. 1 libavcodec 53. 7. 0 / 53. 7. 0 libavformat 53. 4. 0 / 53. 4. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 23. 0 / 2. 23. 0 libswscale 2. 0. 0 / 2. 0. 0 libpostproc 51. 2. 0 / 51. 2. 0 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 2012-03-28 07:13:20 Duration: 00:00:26.23, start: 0.000000, bitrate: 12974 kb/s Stream #0.0(eng): Video: mjpeg, yuvj420p, 1280x720 [PAR 72:72 DAR 16:9], 12972 kb/s, 11.67 fps, 600 tbr, 600 tbn, 600 tbc Metadata: creation_time : 2012-03-28 07:13:20 File 'out.mp4' already exists. Overwrite ? [y/N] y Output #0, mp4, to 'out.mp4': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 2012-03-28 07:13:20 encoder : Lavf53.4.0 Stream #0.0(eng): Video: mjpeg, yuvj420p, 1280x720 [PAR 72:72 DAR 16:9], q=2-31, 12972 kb/s, 600 tbn, 600 tbc Metadata: creation_time : 2012-03-28 07:13:20 Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop, [?] for help frame= 121 fps= 0 q=-1.0 size= 16408kB time=00:00:10.08 bitrate=13332.2kbitsframe= 306 fps= 0 q=-1.0 Lsize= 41543kB time=00:00:26.12 bitrate=13025.0kbits/s video:41538kB audio:0kB global headers:0kB muxing overhead 0.012531%
-
Conrad Lotz over 11 yearsAre you sure these are errors? This looks more like a log file to me. It even asks to overwrite the previous mp4: File 'out.mp4' already exists. Overwrite ? [y/N] y
-
legends2k over 4 yearsSimilar question in SuperUser.
-
-
StudioEvoque almost 11 yearsSince this turns up in the search results, I'll add the updated command for the ffmpeg as of writing:
ffmpeg -i input.mov -qscale 0 output.mp4
-
CyberSkull over 10 years@StudioEvoque what does the
-qscale 0
flag do? -
RonnyKnoxville over 8 years@CyberSkull
-qscale
sets the compression level. The lower the qscale value, the better the quality. The available qscale values range from 1 (highest quality) to 31 (lowest quality). -
Miguel Bartelsman over 7 yearsWouldn't that be equivalent to just renaming the file to .mp4?
-
Baodad about 7 years@MiguelBartelsman, Good question. I've searched around, and I think the answer is that
ffmpeg -i in.mov -c copy out.mp4
is an example of using ffmpeg to change the "container" from .mov to .mp4. I don't think that's the same as renaming the file, but I don't know enough to explain why. I also don't know why that would be "better," except to say that I don't think the process involves any change to the data, i.e. no re-encoding, therefore no quality loss. -
Ichthyo about 7 years@MiguelBartelsman @Baodad a container packages multiple video and audio streams, adds a header and a table-of-contents. The Quicktime (mov) and MPEG (mp4) container work quite different, technically. If you just rename a Quicktime file into mp4, you pretend it to be a MPEG video, but it still remains a Quicktime container. Please note: since you use the
copy
for the codec parameter, you tell FFMpeg to copy the actual media data, without any re-coding into another codec. -
Ichthyo about 7 years@StudioEvoque beware! What you are proposing here is something quite different than the OP did and probably wanted. You don't give a codec spec, thus you ask FFMpeg to transcode the actual media data into the standard codec for associated with the MP4-container. Even if you use the hightest quality settings, transcoding will always loose some quality. Only when you use
-c copy
you ensure that the original media data as such is not touched, only the container changed -
Miguel Bartelsman about 7 years@Ichthyo Thanks for the insight, I find multimedia formats to be quite difficult to understand
-
mrgloom over 5 yearsIt prints
Please use -q:a or -q:v, -qscale is ambiguous
-
bballdave025 over 5 years@mrgloom Make sure you also put a number after the
-q:a
or-q:v
. For example (using the other comments,) I came up with a command that works. Note that I had to use-strict -2
for it to work! The command is:ffmpeg -i movie.mov -q:v 0 -strict -2 cut.mp4
(I'm on WSL,$ uname -a
outputsLinux CAP-D-ENG-INT3 4.4.0-17134-Microsoft #345-Microsoft Wed Sep 19 17:47:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux
.) -
Asbjørn Ulsberg over 4 yearsAs per this Stack Overflow answer I had to add
-pix_fmt yuv420p
for the output file to work with QuickTime Player. -
Shevach Riabtsev over 4 years'-q:v 0' is identical to '-q:v 1' since qscale range is [1..31], where qscale=1 corresponds to maximal quality. Therefore qscale=0 is out of range and is modified to qscale=1.
-
ayke over 3 yearsIf the source audio is encoded as raw PCM audio (for example, for a video from a digital camera) you may want to encode the audio but keep the video lossless. You can do this with:
ffmpeg -i MVI_0887.MOV -vcodec copy -acodec aac ~/MVI_0887.mp4
. This keeps the original video the same (so is an entirely lossless copy) while encoding the audio in a new format that is available in the MP4 format.