1

Example 1: ffmpeg -i input.avi -c:v libxvid output.mp4

The code that I get as output is:

ffmpeg -i input_1.avi -c:v libxvid output_1.mp4
ffmpeg version git-2020-02-16-8578433 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 41.100 / 56. 41.100
  libavcodec     58. 70.100 / 58. 70.100
  libavformat    58. 38.101 / 58. 38.101
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 76.100 /  7. 76.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, avi, from 'input_1.avi':
  Duration: 00:00:02.53, start: 0.000000, bitrate: 498000 kb/s
    Stream #0:0: Video: rawvideo (Y800 / 0x30303859), gray, 1920x1080, 504300 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (libxvid))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output_1.mp4':
  Metadata:
    encoder         : Lavf58.38.101
    Stream #0:0: Video: mpeg4 (libxvid) (mp4v / 0x7634706D), yuv420p, 1920x1080, q=2-31, 200 kb/s, 30 fps, 15360 tbn, 30 tbc
    Metadata:
      encoder         : Lavc58.70.100 libxvid
frame=   76 fps= 41 q=31.0 Lsize=     313kB time=00:00:02.50 bitrate=1024.0kbits/s speed=1.35x
video:311kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.371668%

Example 2:

Maybe the libxvid was not the best example. What if I would use a lossless compression such as x264:

ffmpeg -i input.avi -c:v libx264 -preset veryslow -crf 0 output.mp4

What command do you use if you want to ask ffmpeg to decompress a video file for you?

2 Answers2

3

Assuming your input file is using 4:2:0 color space, you can decode the (lossily) encoded video and output the raw frames to an AVI container:

ffmpeg -i output.mp4 -c:v rawvideo -pix_fmt yuv420p output.avi

ffmpeg will "decompress" (i.e. decode) the MPEG-4 video stream from the output.mp4 file and write it as raw video to the output.avi file.

Raw video is uncompressed, but since the original video was already compressed using a lossy algorithm (e.g. by libxvid), any quality loss present in output.mp4 will obviously also be present in output.avi. You will just get a much bigger output file.

slhck
  • 235,242
-1

You just compressed (lossly) your original (compressed) avi file in another format. you could do ffmpeg -i output.mp4 -c:v msmpeg4v2 -c:a copy new_avi.avi

Obviously any quality loss in the mp4 is lost forever (you need the original source file to get quality back)

ffmpeg -i output.mp4 -c:v copy -c:a copy output.avi will instead just replace the container (mp4 to avi).

DDS
  • 759