1

What I want to do: I have a folder with a great bunch of images. Using these files I want to create a slideshow video, while I want the filename of each of the original images burned into the bottom right corner.

What my current state is: I made a script to fetch all .jpg files in the folder and make a ffmpeg-readable list and I know how to concat the images to a slideshow and everything works as intended. I also figured out how to use FFmpeg's drawtext to get a handsome filename stamp.

Now the problem: Currently FFmpeg grabs the last filename from the file list (for example IMG_9935.jpg) and burns it into the entire video. But what I want to happen is, that it changes with each 'new' image - just like a timecode would change during the course of the video.

Is any of this possible?

As a side note: "Why don't you burn the filename beforehand?" I'd like to keep it as flexible as possible. So if there's another way round, I'd like to go that way.

for i in *.jpg; do echo "file '$i'" >> files.txt; done

ffmpeg -r 1/3 -f concat -safe 0 -i files.txt -vf
"eq=text=$(echo $i | rev | cut -d / -f 1 | rev): fontcolor=0x808080:
fontsize=14: x=w-tw- 10:y=h-th-10" -c libx264 filename.mp4
0

1 Answer 1

2

The concat demuxer allows setting per-file metadata entry, but this has to be done manually.

You would change your script to

for i in *.jpg; do echo "file '$i'" >> files.txt; echo "file_packet_metadata url=$i" >> files.txt; done

ffmpeg -r 1/3 -f concat -safe 0 -i files.txt -vf
"drawtext=text='%{metadata\:url}': fontcolor=0x808080:
fontsize=14: x=w-tw- 10:y=h-th-10" -r 12 -c:v libx264 filename.mp4
0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.