How to add creation_time to a screen recording done using ffmpeg

Thank you for your opportunity to answer this question.

Sure, I can help you with that.

Firstly, to add metadata such as creation_time to your output file while executing the screen recording command, you can use -metadata option in ffmpeg. Here is an example command:

ffmpeg -f x11grab -r 30 -s 1024x768 -i :0.0 -metadata creation_time="$(date +%Y-%m-%dT%H:%M:%S)" output.mp4

Here,

$(date +%Y-%m-%dT%H:%M:%S)

will get the current date and time in the format YYYY-MM-DDTHH:MM:SS which is the format ffmpeg expects for creation_time. The -metadata option is used to add metadata to the output file.

Now, once the file is created, you can extract the creation_time metadata using ffprobe, a companion utility to ffmpeg that is used for probing multimedia streams. Here is how you can do it:

ffprobe -v quiet -print_format json -show_format -show_streams output.mp4 | grep creation_time

This command will return a json output of the file’s metadata and streams information. The grep creation_time command will filter out the creation_time from that output.

Let me know if you need any more help!

Read more here: Source link