ffmpeg -i video.mp4 -c:a copy -c:v ayuv output.avi.
#HOW TO COMPRESS VIDEO FILES USING FFMPEG MP4#
For example, an AVI video file might still be larger than the small file of MP4 type despite being a small size. There is no universal way to reduce a video file size because various file types are not created equal. Video Compressions Using crf flag You can also reduce the file size by applying the flag called as crf flag like this ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4 Video Compression by Using Bitrate ffmpeg -i input.mp4 -b 800k. However, to compress files efficiently, we need to use codecs, bitrate, container, and fps. Avi is a container of streams and thus does not know anything about 'converting'. FFmpeg automatically will apply the default compressions and it will considerably reduced the file video size. That is a codec that only contains I-Frames.
#HOW TO COMPRESS VIDEO FILES USING FFMPEG WINDOWS#
(In the Windows shell, replace -i Imgp%04d.jpg with -i "Imgp%%04d.jpg". Since the input stream is encoded ffmpeg has to convert it into a 'lossless' codec. The -s option rescales the pictures to the desired resolution to manage the size of the resulting video. ffmpeg -re -y -i INPUTFILE -vcodec libx264 -b:v 600k -r 25 -s 640×360 -filter:v yadif -ab 64k -ac 1 -ar 44100 -f flv rtmp://STREAMINGLOCATION. You can find out the codec names (to put next to -c:a and -c:v. Compress video using x264, specify video bitrate, framerate, resolution, etc. The -r 3 option sets the framerate of the resulting video to 3 frames per second so that I can see each still for a short period of time. In another example, to convert an mp4 video named originalvideo.mp4 to MKV file format named convertedvideo using h264 encoding for video and ac3 encoding for audio, the command should turn into something like: ffmpeg -i originalvideo.mp4 -c:a ac3 -c:v h264 convertedvideo.mkv. In this case I want to keep streams 0:1 (video), 0:3 (5.1 audio), and 0:4 (audio stereo).
If we want to keep all our audio streams then we have to explicitly tell ffmpeg this using the -map directive, one per stream we want to keep, in order. I use the following one-liner to get a slower frame rate and to compress the images and have a smaller resulting video: ffmpeg.exe -f image2 -framerate 25 -pattern_type sequence -start_number 1234 -r 3 -i Imgp%04d.jpg -s 720x480 test.avi By default ffmpeg only extracts the best video and best audio stream it can find. There are some other switches you might find useful. If there are gaps and you want all of the stills included, then renumbering may be necessary to fill the gaps. Note, this will work as long as the sequence is unbroken once it starts.
Where n is the start of the sequence of stills. Here is the help output from version 3.4.6 on Ubuntu 18.04 Encoder libx265 libx265 H. libx265 is fairly new, older versions of ffmpeg will not have it compiled in. There is no need to rename files if using the -start_number switch like so: ffmpeg -start_number n -i test_%d.jpg -vcodec mpeg4 test.avi Answer (1 of 2): -crf 0 will give lossless compression (according to forum searches.