Amazing things with FFMPEG Library

FFMPEG is a complete, cross-platform solution to record, convert and stream audio and video. This is available for all the kind development(i.e. Android, iPhone, Web etc)

Below are the advanced things that can be done in FFMPEG:


Add Text in center of Video:
ffmpeg -i temp.mp4 -vf drawtext="fontfile=verdana.ttf: \ text='Aftab Muni...': fontcolor=white: fontsize=14: box=1: boxcolor=black: \ x=(w-text_w)/2: y=(h-text_h-line_h)/2" -codec:a copy output.mp4

Add text on top-left which will blink:
ffmpeg -i temp.mp4 -vf drawtext="verdana.ttf:fontcolor=white:x=100:y=x/dar:
enable=lt(mod(t\,3)\,1):text='blink'" -codec:a copy output.mp4

To flip video horizontally:
ffmpeg -i temp.mp4 -vf "hflip" temp_out.mp4

To Add logo on video:
ffmpeg -i temp.mp4 -i logo.png -filter_complex "overlay=10:main_h-overlay_h-10" logo.mp4

To Get thumbnail from video:
ffmpeg -i temp.mp4 -vf thumbnail,scale=300:200 -frames:v 1 out.png

Create image from video:
ffmpeg -i input.mov -an -ss 00:00:05 -r 1 -vframes 1 -y thumb.png

Convert video from mov to mp4:
ffmpeg -i input.mov -vcodec copy -acodec copy out_input.mp4

Convert video in any size: eg scale=180:120 etc..
ffmpeg -i temp.mp4 -vf scale=640:360 temp_out.mp4

Mute Audio from video: eg 5:11 means audio will be audible during 5to11secs.
ffmpeg -i temp.mp4 -af atrim=5:11 out.mp4

Convert video from flv to mp4:
ffmpeg -i johny.flv -qscale 0 -ar 22050 -vcodec libx264 out_johny.mp4

Create GIF Animated file from video:
ffmpeg -i johny.flv -an -ss 00:00:10 -r 1 -vframes 30 -y -f gif johny.gif

Replacing another audio in a video file:
ffmpeg -i dummy.mp3 -i johny.flv final_video.mp4

Create images for each frame:
ffmpeg -i dust.mp4 image%d.jpg

Creating video from lots of images: here image name will be image1.jpg,image2.jpg...etc
ffmpeg -f image2 -i image%d.jpg image_to_video.mp4

Create MP3 from video file:
ffmpeg -i johny.flv -ab 192k audio.mp3

Create clip from long video:
ffmpeg -ss 00:00:27 -t 00:00:10 -i johny.flv -async 1 -qscale 3.5 -vcodec flv poem_cut.mp4

ffmpeg -i temp.mp4 -vf drawtext="fontfile=HelveticaMedium.ttf: \ text='Aftab Muni...': fontcolor=red: fontsize=20: x=(w-text_w)/2: y=(h-text_h-line_h)/2:enable='between(t,5,10)'" -codec:a copy output.mp4

For more information and examples, please go to http://www.ffmpeg.org/

Advertisements

One thought on “Amazing things with FFMPEG Library

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s