FFMPEG Installation & Compilation
Onkar Dubey
Using Ubuntu 16.04.3 LTS
I successfully figured it out by my self, here is how.
remove the current ffmpeg by running:
$ sudo apt-get remove --purge ffmpeg
Add ppa trusty-media for 14.04:
$ sudo apt-add-repository ppa:mc3man/trusty-media
For 16.04, add the following Repo:
$ sudo apt-add-repository ppa:jonathonf/ffmpeg-3
Update repo:
$ sudo apt-get update
Finally install it:
$ sudo apt-get install ffmpeg
Install the dependencies by typing Link:
$ sudo apt-get update
$ sudo apt-get -y --force-yes install autoconf automake build-essential libass-dev libfreetype6-dev \
libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev
ffmpeg
$ mkdir /home/user/ffmpeg
$ cd /home/user/ffmpeg
$ wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
$ tar xjvf ffmpeg-snapshot.tar.bz2
$ cd ffmpeg
$ PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--bindir="$HOME/bin" \
--enable-gpl \
......
.......
$ PATH="$HOME/bin:$PATH" make
$ make install
$ make distclean
Then execute:
$ home/user/ffmpeg/bin/ffmpeg -i ../input.avs ../videos/output.avi
help:
https://www.wowza.com/docs/how-to-use-ffmpeg-with-wowza-media-server-mpeg-ts
http://ubuntuhandbook.org/index.php/2017/05/install-ffmpeg-3-3-in-ubuntu-16-04-14-04/
http://www.nerdfirst.net/getting-started-with-ffmpeg/
commands:
To target the Audio
$ ffmpeg -i infile.mp3 -b:a 320k outfile.mp3
To To specify bot audio and video bitrates:
$ ffmpeg -i inFile.avi -b:v 1000k -b:a 128k outFile.mp4
Basic Syntax
ffmpeg -i <input name> -q <quality> <output name>
Specifying quality:
for AVI: ffmpeg -i <input name> -q <quality> <output name>
for MP4: ffmpeg -i <input name> -crf <quality> <output name>
To specify Exact bitrates
for audio: ffmpeg -i <input name> -b:a <bitrat> <output name>
for video: ffmpeg -i <input name> -b:v <bitrate> <output name>
Filter:
audio volume
audio channel map
video crop
video scale
video rotete
1- volume tweak
syntax: ffmpeg -i inputFile -filter:a "volume=2" outputFile
2- channel remapping:
syntax: ffmpeg -i inputFile -filter:a "channelmap=0-0|0-1" outputFile
3- Video croping
syntax: ffmpeg -i inFile -filter:v "crop=w=2/3*in_w:h=2/3*in_h" outFile
syntax: ffmpeg -i inFile -filter:v "crop=w=640:h=480:x=100:y=200" outFile
4-Scaling
syntax ffmpeg -i inFile -filter:v "scale=w=640:h=480" outFile
Scaling with airthmatic & variables
ffmpeg -i inFile -filter:v "scale=w=2/3*in_w:h=2/3*in_h" outFile
Proportional Scaling:
ffmpeg -i inFile -filter:v "scale=w=852:h=-1" outFile
5- Rotation
syntax: ffmpeg -i inFile -filter:v "rotate=45*PI/180" outFile
#recap
ffmpeg -i input.avi -vf<filter string> output.avi
-vf "
filter1 =
setting1 = value1 :
setting2 = value2 ,
filter2=
setting1 = value1 :
setting2 = value2
"
************* Stream***********
ffplay -probesize 32 -sync ext /home/om/om/dangal.mp4
To send video
furst terminal
$ ffmpeg -i /home/om/om/dangal.mp4 -v 0 -vcodec mpeg4 -f mpegts udp://127.0.0.1:23000
second terminal
$ ffplay udp://127.0.0.1:23000
ffmpeg -i /home/om/o/z.mp4 -map 0 -c:v h264_nvenc -preset:v llhq -c:a aac -muxrate 2500k -bufsize 3500k -g 50 -f tee \
"[f=flv:onfail=ignore]rtmp://live.twitch.tv/app/<stream key>|[f=flv:onfail=ignore]rtmp://a.rtmp.youtube.com/live2/<stream key>|local_file.mkv"
Capture Screan
https://trac.ffmpeg.org/wiki/Capture/Desktop
$ ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 output.mp4
1-$ ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 udp://227.30.40.50:1234
2-$
Give Something to the world and it will never let you down.
Onkar Dubey
No comments:
Post a Comment