Saturday, 12 July 2025

Five Powerful Uses of the FFmpeg Command

FFmpeg is a powerful command-line tool used for processing audio and video files. Whether you're converting formats, compressing media, or extracting audio, FFmpeg offers incredible flexibility. Below are five different ways to use the ffmpeg command.

1. Convert Video Format

You can easily convert a video from one format to another. For example, to convert an MP4 file to AVI:

ffmpeg -i input.mp4 output.avi

This command reads input.mp4 and outputs output.avi using default codecs.

2. Extract Audio from Video

Need just the audio from a video file? FFmpeg makes it simple:

ffmpeg -i input.mp4 -q:a 0 -map a output.mp3

This extracts the audio from input.mp4 and saves it as an MP3 file.

3. Compress Video File

To reduce video file size while maintaining quality:

ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output_compressed.mp4

The -crf value controls the quality and compression. Lower values mean better quality.

4. Create a Video from Images

If you have a sequence of images like img001.jpg, img002.jpg, ..., you can create a video:

ffmpeg -framerate 24 -i img%03d.jpg -c:v libx264 -pix_fmt yuv420p output.mp4

This compiles the images into a 24 fps MP4 video.

5. Cut a Clip from a Video

To extract a specific portion of a video without re-encoding:

ffmpeg -ss 00:01:00 -to 00:02:00 -i input.mp4 -c copy clip.mp4

This creates a 1-minute clip starting from the 1-minute mark.

Conclusion

FFmpeg is an essential tool for any multimedia task. These five examples are just the beginning—its capabilities go much further, including streaming, filtering, and batch processing.

No comments:

Post a Comment