Linux/ffmpeg

From Omnia
Jump to: navigation, search

convert flv to mp4

Convert flv to mp4, by changing container without re-encoding:

 ffmpeg -i input.flv -codec copy output.mp4

Convert flv to mp4: [1]

ffmpeg -i filename.flv -c:v libx264 -crf 19 -strict experimental filename.mp4
ffmpeg -i input.flv -codec copy output.mp4
ffmpeg -i filename.flv -ab 56 -ar 22050 -b 500 -s 320x240 filename.mpg
avconv -i inputfile.flv -map 0 -c:v libx264 -c:a copy outputfile.mp4
# same as:
ffmpeg -i filename.flv -vcodec libvpx -acodec libvorbis
avconv -i inputfile.flv -map 0 -c:v libx264 -c:a copy outputfile.mp4
ffmpeg -i $1 -sameq -ar 22050 -vcodec libx264 $1.mp4 

guide [2]

ffmpeg -i input.flv -c copy -copyts output.mp4

Extract Music from mp4

See mp4

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: