What we use for video:
sudo ffmpeg -i inputfile.ext -acodec aac -ac 2 -strict experimental -vcodec libx264 -profile:v baseline -level 30 outputfile.flv
(same settings as in MistServer guide 2015 Spring and August)
Another video option from the MistServer group/forum:
sudo ffmpeg -i inputfile.ext -ar 22050 -ac 6 -strict -2 -acodec aac -vcodec h264 -f flv outputfile.flv
If the file is already H264/AAC, you don't need to convert if just switching containers. This one is faster to make a FLV:
sudo ffmpeg -i inputfile.mp4 -acodec copy -vcodec copy -f flv outputfile.flv
If you accidently used the wrong encoding (e.g. Main instead of Baseline) for your streaming server, you can fix the video and just copy the "good" aac audio:
sudo ffmpeg -i smsoutputfile.flv -acodec copy -strict experimental -vcodec libx264 -profile:v baseline -level 30 smsoutputfile.mp4
sudo ffmpeg -i smsoutputfile.flv -acodec copy -strict experimental -vcodec libx264 -profile:v baseline -level 30 smsoutputfile-b.flv
sudo mv smsoutputfile-b.flv smsinputfile.flv
Here's a variation we use to crop and convert the file:
sudo ffmpeg -ss 175 -i inputfile.ext -acodec aac -ac 2 -strict experimental -vcodec libx264 -profile:v baseline -level 30 outputfile.flv
(For the example above, we are trimming 175 seconds off the beginning of the video and converting from one container and codec to another. )
Here's a variation to trim the ending off and keep 7 minutes and 32 seconds of the video:
sudo ffmpeg -t 00:07:32 -i inputfile.ext -acodec copy -vcodec copy mp4 outputfile.mp4
or to trim the beginning...
sudo ffmpeg -i input.ext -ss 2 -vcodec copy -acodec copy output.ext
What we use for audio:
(We make a FLV and a MP4 for our VOD streaming server.)
sudo ffmpeg -loop 1 -i /home/sysadmin/NBAudioPic.jpg -i loc20150519soak.wav -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest loc20150519soak.flv
sudo ffmpeg -loop 1 -i /home/sysadmin/NBAudioPic.jpg -i loc20150519soak.wav -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest loc20150519soak.mp4
What we used to use:
sudo ffmpeg -i inputfile.ext -deinterlace -ar 44100 -r 25 -qmin 3 -qmax 6 outputfile.flv
(We then change preferences of stream settings to say we want MP3 streaming. This gives us great portability to PC/Mac/ioS/Android devices.
What we use for audio mp3 or mov file when we add a "looping" image if the audio is already in aac MOV format:
sudo ffmpeg -y -loop_input -i inputfile.ext -i /home/myid/img.jpg -r 1/4 -g 0 -acodec copy video.flv
or
sudo ffmpeg -loop 1 -i /home/sysid/Pictures/AudioPic.jpg -i inputfile.ext -acodec copy -shortest -r 1 video.flv
_________________________________
Trim time off the beginning and the end of a movie:
$ /Users/tripp/Library/Application\ Support/Adapter/ffmpeg -ss 82 -t 01:19:24 -i abc1.m4v -vcodec libx264 -af "volume=5dB" abc1trimmed.mp4
_________________________________
Increase the volume of the audio:
$ ffmpeg -i videoquiet.mp4 -af "volume=5dB" vidio5dblouder.mp4
_________________________________
ProPresenter Conversions:
Remove audio:
$ sudo ffmpeg -i Earth.mp4 -an -vcodec copy Earth2.mp4
Resize for 3x1 format with "letterbox":
$ sudo ffmpeg -i input.mp4 -vf "scale='min(2028,iw)':min'(676,ih)':force_original_aspect_ratio=decrease,pad=2028:676:(ow-iw)/2:(oh-ih)/2" output.mp4
Resize for 3x1 format with cropping instead:
$ sudo ffmpeg -i input -vf "scale=2028:676:force_original_aspect_ratio=increase,crop=2028:676" output
Scripts to trim multiple MP4 files and to convert M4V to MP4 and trim at the same time:
#!/bin/bash
for name in *.mp4; do
sudo ffmpeg -nostdin -i "$name" -an -vf "scale=2028:676:force_original_aspect_ratio=increase,crop=2028:676" "n_$name"
done
#!/bin/bash
for name in *.m4v; do
sudo ffmpeg -nostdin -i "$name" -an -vf "scale=2028:676:force_original_aspect_ratio=increase,crop=2028:676" "n_${name[@]/%m4v/mp4}"
done
Misc. Tips:
Loop a Video 5 Times:
$ sudo ffmpeg -f concat -safe 0 -i <(for i in {1..4}; do printf "file '%s'\n" /videos/input.mp4; done) -c copy /videos/output.mp4
Slow down a video to 1/3 speed:
$ sudo ffmpeg -i input.mp4 -filter:v "setpts=3*PTS" output.mp4
previous page
|