Friday, December 7, 2012

FFMPEG : Video Editing Tool


Ffmpeg is the one of the best tool available to us to perform operation on video and audio

Installing ffmpeg in Linux
--------------------------
  1. Open your terminal and login as root user 
  2. Update your repository
  3. FFMPEG is available in the ubuntu repository. so install it directly
  • apt-get update
  • sudo apt-get update
  • sudo apt-get install build-essential git-core checkinstall texi2html libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvorbis-dev libx11-dev libxfixes-dev zlib1g-dev automake autoconf libxvidcore-dev 
  • apt-get install ffmpeg


Basics of FFMPEG-Options
Command:
    ffmpeg

Input file:
    -i yoursourcefile

Optional rescaling
    -s 640x480

Video conversion (choose one)
    -vcodec copy
    -vn (No Video)

Audio conversion (choose one)
    -acodec libmp3lame -ab 64k
    -acodec copy
    -an (No audio)

Output file (this name appears on the line without an option before it)
    youroutputfile

Mixing two Audio files
ffmpeg -i thelusa.mp3 -itsoffset 3.3 -i Fly-By-II.mp3  -filter_complex amix outputFile.mp3 

To mix more than two files please repeat the above command  with replacing first input file with outcome of the above and second input file with newmp3 file . ie., 

ffmpeg -i outputFile.mp3 -itsoffset 3.3 -i badBoys.mp3  -filter_complex amix outputFile2.mp3 
Repeat this process to get the desired outcome from the n-files mixing .

Cutting video file
 ffmpeg -i input.flv -ss 00:00:00 -t 00:10:00  -y output.flv  
 The above command will cut the video of 10 mins from the given input.flv file and generate the outcome as  output.flv

Append Two Audio Files
 copy /b file1.mp3 + file2.mp3  out.mp3

 copy /b file1.flv + file2.flv  out.flv

Extract Audio From video file 
 ffmpeg -i input.avi  -vn -acodec copy output.avi

To record your screen withh FFMPEG, you can use this command:

ffmpeg -f x11grab -follow_mouse 100 -r 25 -s vga -i :0.0 filename.avi
To show the region that will be recorded while moving your mouse pointer, use this command:

ffmpeg -f x11grab -follow_mouse centered -show_region 1 -r 25 -s vga -i :0.0 filename.avi

If you want to record in fullscreen with better video quality (HD), you can use this command:

ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq  video.mp4


Add Image Watermarks to A Video 

Picture Location: Top Left Corner
ffmpeg -i input.avi -vf "movie=file.png [watermark]; [in][watermark] overlay=10:10 [out]" output.flv

Picture Location: Top Right Corner

ffmpeg –i input.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" output.flv

Picture Location: Bottom Left Corner

ffmpeg –i input.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]" output.flv

Picture Location: Bottom Right Corner

ffmpeg –i input.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]" output.flv

Add Text as Watermarks to A Video 

ffmpeg -i input.mp4 -vf drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf: text='YOUR TEXT HERE':fontcolor=red@1.0:fontsize=70:x=00: y=40" -y output.mp4

 


No comments:

Post a Comment