user3455531
user3455531

Reputation: 785

convert videos to mp4 via ffmpeg faster

I am converting a single video to 4 different qualities(1080p,720p,480p,360p), 4 thumbnails(720px,480px), and a thumbnail each second(50px) via ffmpeg. For a 2 minute video it takes the server 10 minutes to do all this.. here is my conversion code for a video

ffmpeg -y -i $converturl -filter:v scale=\"640:trunc(ow/a/2)*2\",setsar=1/1 -pix_fmt     yuv420p -c:v libx264 -preset:v fast -profile:v high  -x264opts level=4.0:ref=1 -b:v 300k -r:v 25/1 -force_fps  -movflags +faststart -c:a libfaac -b:a 128k -pass 1 $converturlnew

My server's processor : Xeon E5-2620 v2 RAM 32 GB DDR3

Upvotes: 0

Views: 2455

Answers (1)

nishantjr
nishantjr

Reputation: 1820

Try specifying the -threads 0. Ffmpeg should use the optimal number of threads to encode the video, utilizing multiple CPU cores.

Also try specifying multiple outputs in the same command line. Just guessing, but ffmpeg should only do the decoding (and other common operations in the pipeline) of the original video just once, instead of once for each output.

Upvotes: 1

Related Questions