1

First question on this site, unsure if it's off-topic to ask for specific solutions to specific problems. If it is, I'm sorry in advance.

Code

I have the following ffmpeg command inside a bash script. You can assume I have values for all the variables in it - it is working just fine as it is, after all.

blackout_duration=14
transition_time=2
dur=$(ffprobe -loglevel error -show_entries format=duration -of default=nk=1:nw=1 "$1.mp3")
echo "Duration $dur"
offset=$(bc -l <<< "$dur"-"$blackout_duration")
ffmpeg -hide_banner -loop 1 -i $1.png -i $1.mp3 -c:v libx264 -preset ultrafast -tune stillimage -pix_fmt yuv420p -shortest -filter_complex "[0:v]fade=type=out:duration=$transition_time:start_time='$offset'[v]" -map "[v]" -map "1:a" $1.mkv

Description

  • Combines a png and mp3 files together to produce one mkv video file.
  • Fades the last n seconds to black (while there's still some music playing in the audio).

On a reasonably modern CPU (i7-8665U), I'm getting around 60 FPS while processing this.

Is it me or this seems awfully slow, given the fact that there's absolutely no process being done on the audio and the video is just the same frame repeated over and over?

And, if it is, could you provide a better approach?

Thank you

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.