Linux/ffmpeg

From Omnia
< Linux
Revision as of 21:05, 16 August 2020 by Kenneth (talk | contribs) (→‎Extract Music from mp4)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Installation

Ubuntu: [1] [2] [3]

sudo add-apt-repository ppa:mc3man/trusty-media  
sudo apt-get update  
sudo apt-get install ffmpeg  
# sudo apt-get install frei0r-plugins
# sudo apt-get install ffmpeg gstreamer0.10-ffmpeg

convert flv to mp4

See flv

Extract Music from mp4

See mp4

m4a:

ffmpeg -i input.mp4 -vn -c:a copy output.m4a

jpeg slideshow

mkdir show
x=1 ; for i in *jpg; do counter=$(printf %05d $x); ln "$i" show/img"$counter".jpg; x=$(($x+1)); done
cd show
ffmpeg -r 10 -i img%05d.jpg -c:v libx264 out.mp4
ffmpeg -r 1/5 -start_number 2 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
ffmpeg -r 1/5 -i img%03d.png -c:v libx264 -vf fps=25 -pix_fmt yuv420p out.mp4
ffmpeg -framerate 1/5 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
ffmpeg -f image2 -i /tmp/img%03d.jpg /tmp/a.mpg
ffmpeg -r 60 -f image2 -s 1920x1080 -i pic%04d.png -vcodec libx264 -crf 25  -pix_fmt yuv420p test.mp4
#  %04d means that zeros will be padded until the length of the string is 4
#  -r is the framerate (fps)
#  -crf is the quality, lower means better quality, 15-25 is usually good
#  -s is the resolution
#  -pix_fmt yuv420p specifies the pixel format, change this as needed

References:

keywords