• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
43
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Useful FFmpeg Commands
    1. 1. Get Video File Information
    2. 2. Split a video into images
    3. 3. Convert images into a video
    4. 4. Convert a video into mp3 format
    5. 5. Covert flv video file to mpg format
    6. 6. Convert video into animated gif
    7. 7. Convert mpg video file to flv
    8. 8. Convert avi video file to mpeg
    9. 9. Convert a video to CD or DVD format
    10. 10. Extract audio from video file
    11. 11. Mix a video and audio together
    12. 12. Increase/Reduce Video Playback Speed
    13. 13. Compare/Test Video and Audio Quality
    14. 14. Add Photo or Banner to Audio
    15. 15. Add subtitles to a Movie
  2. Summary

In this article we are going to look at some options and examples of how you can use FFmpeg multimedia framework to perform various conversion procedures on audio and video files.

15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

15 FFMPEG Command Examples in Linux

For more details about FFmpeg and steps to install it in different Linux distros, read the article from the link below:

FFmpeg Multimedia Framework Installation Guide on Linux – Part 1

Useful FFmpeg Commands

FFmpeg utility supports almost all major audio and video formats, if you want to check the ffmpeg supported available formats you can use ./ffmpeg -formats command to list all supported formats. If you are new to this tool, here are some handy commands that will give you a better idea about the capabilities of this powerful tool.

1. Get Video File Information

To get information about a file (say video.mp4), run the following command. Remember you have to specify an ouput file, but in this case we only want to get some information about the input file.

$ ffmpeg -i video.flv -hide_banner
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Get Video Information

Note: The -hide_banner option is used to hide a copyright notice shown my ffmpeg, such as build options and library versions. This option can be used to suppress printing this information.

For example, if you run the above command without adding -hide_banner option it will print the all FFmpeg tools copyright information as shown.

$ ffmpeg -i video.flv
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Hide FFmpeg Version Information

2. Split a video into images

To turn a video to number of images, run the command below. The command generates the files named image1.jpg, image2.jpg and so on…

$ ffmpeg -i video.flv image%d.jpg
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Split Video into Images

After successful execution of above command you can verify that the video turn into multiple images using following ls command.

$ ls -l

total 11648
-rw-r--r-- 1 tecmint tecmint   14592 Oct 19 13:19 image100.jpg
-rw-r--r-- 1 tecmint tecmint   14603 Oct 19 13:19 image101.jpg
-rw-r--r-- 1 tecmint tecmint   14584 Oct 19 13:19 image102.jpg
-rw-r--r-- 1 tecmint tecmint   14598 Oct 19 13:19 image103.jpg
-rw-r--r-- 1 tecmint tecmint   14634 Oct 19 13:19 image104.jpg
-rw-r--r-- 1 tecmint tecmint   14693 Oct 19 13:19 image105.jpg
-rw-r--r-- 1 tecmint tecmint   14641 Oct 19 13:19 image106.jpg
-rw-r--r-- 1 tecmint tecmint   14581 Oct 19 13:19 image107.jpg
-rw-r--r-- 1 tecmint tecmint   14508 Oct 19 13:19 image108.jpg
-rw-r--r-- 1 tecmint tecmint   14540 Oct 19 13:19 image109.jpg
-rw-r--r-- 1 tecmint tecmint   12219 Oct 19 13:18 image10.jpg
-rw-r--r-- 1 tecmint tecmint   14469 Oct 19 13:19 image110.jpg

3. Convert images into a video

Turn number of images to a video sequence, use the following command. This command will transform all the images from the current directory (named image1.jpg, image2.jpg, etc…) to a video file named imagestovideo.mpg.

There are many other image formats (such as jpeg, png, jpg, etc) you can use.

$ ffmpeg -f image2 -i image%d.jpg imagestovideo.mpg
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Convert Images to Video

4. Convert a video into mp3 format

To convert an .flv format video file to Mp3 format, run the following command.

$ ffmpeg -i video.flv -vn -ar 44100 -ac 2 -ab 192 -f mp3 audio.mp3
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Convert Video to Audio

Description about the options used in above command:

  1. vn: helps to disable video recording during the conversion.
  2. ar: helps you set audio sampling rate in Hz.
  3. ab: set the audio bitrate.
  4. ac: to set the number of audio channels.
  5. -f: format.

5. Covert flv video file to mpg format

To convert a .flv video file to .mpg, use the following command.

$ ffmpeg -i video.flv video.mpg
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Convert Avi to MPG Video Format

6. Convert video into animated gif

To convert a .flv video file to animated, uncompressed gif file, use the command below.

$ ffmpeg -i video.flv animated.gif.mp4
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Covert Video to Animated Gif

7. Convert mpg video file to flv

To convert a .mpg file to .flv format, use the following command.

$ ffmpeg -i video.mpg -ab 26k -f flv video1.flv
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Convert Mpg to Flv Video Format

8. Convert avi video file to mpeg

To convert a .avi file to mpeg for dvd players, run the command below:

$ ffmpeg -i video.avi -target pal-dvd -ps 2000000000 -aspect 16:9 video.mpeg

Explanation about the options used in above command.

  1. target pal-dvd : Output format
  2. ps 2000000000 maximum size for the output file, in bits (here, 2 Gb).
  3. aspect 16:9 : Widescreen.
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Convert Avi to Mpeg Video Format

9. Convert a video to CD or DVD format

To create a video CD or DVD, FFmpeg makes it simple by letting you specify a target type and the format options required automatically.

You can set a target type as follows: add -target type; type can of the following be vcd, svcd, dvd, dv, pal-vcd or ntsc-svcd on the command line.

To create a VCD, you can run the following command:

$ ffmpeg -i video.mpg -target vcd vcd_video.mpg
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Convert Video to DVD Format

10. Extract audio from video file

To extract sound from a video file, and save it as Mp3 file, use the following command:

$ ffmpeg -i video1.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 audio3.mp3

Explanation about the options used in above command.

  1. Source video : video.avi
  2. Audio bitrate : 192kb/s
  3. output format : mp3
  4. Generated sound : audio3.mp3
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Extract Audio from Video

11. Mix a video and audio together

You can also mix a video with a sound file as follows:

$ ffmpeg -i audio.mp3 -i video.avi video_audio_mix.mpg
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Mix Video and Audio

12. Increase/Reduce Video Playback Speed

To increase video play back speed, run this command. The -vf option sets the video filters that helps to adjust the speed.

$ ffmpeg -i video.mpg -vf "setpts=0.5*PTS" highspeed.mpg
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Increase Video Playback Speed

You can also reduce video speed as follows:

$ ffmpeg -i video.mpg -vf "setpts=4.0*PTS" lowerspeed.mpg -hide_banner
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Reduce Video Playback Speed

13. Compare/Test Video and Audio Quality

To compare videos and audios after converting you can use the commands below. This helps you to test videos and audio quality.

$ ffplay video1.mp4
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Test Video Quality

To test audio quality simply use the name of the audio file as follows:

$ ffplay audio_filename1.mp3
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Test Audio Quality

You can listen to them while they play and compare the qualities from the sound.

14. Add Photo or Banner to Audio

You can add a cover poster or image to an audio file using the following command, this comes very useful for uploading MP3s to YouTube.

$ ffmpeg -loop 1 -i image.jpg -i Bryan/ Adams/ -/ Heaven.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

Add Image to Audio

15. Add subtitles to a Movie

If you have a separate subtitle file called subtitle.srt, you can use following command to add subtitle to a movie file:

$ ffmpeg -i video.mp4 -i subtitles.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast video-output.mkv

Summary

That is all for now but these are just few examples of using FFmpeg, you can find more options for what you wish to accomplish. Remember to post a comment to provide information about how to use FFmpeg or if you have encountered errors while using it.

Reference: https://ffmpeg.org/

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
Previous Post

15 Practical Examples of “dpkg commands” for Debian Based Distros

Next Post

The Power of Linux “History Command” in Bash Shell

Next Post

The Power of Linux “History Command” in Bash Shell

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet