Opened 3 years ago

Last modified 8 months ago

#2874 open enhancement

Export image2 file name as frame metadata

Reported by: jlubeck Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: drawtext image2
Cc: alexandre.schmidt@gmail.com, anthony@derobert.net Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I'm creating a timelapse which I would love to include the "timecode" of when each picture was taken.

Currently, the timecode option creates one for everyframe of the video.

Also, using text='\%T' seems to work only for real-time streams.

I have files named:
2013-08-16_001032.jpg
2013-08-16_002045.jpg
2013-08-16_003024.jpg
2013-08-16_004043.jpg
and so on... That is year-month-date_hourminutesecond.jpg

I'm currently using the following:

% ffmpeg -y -i "2013-08-14_%*.jpg" -vf "drawtext=fontfile=/Library/Fonts/AppleGothic?.ttf: text=%{n}:expansion=normal: r=25: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" output.m4v

And it is printing a new number on each frame. It would be great if instead of %{n} we could use something to grab the filename, or even better, meta data from the jpg to be able to format the timestamp. But just with the file name would be great.

ffmpeg version 1.2.1

Thanks!

Change History (12)

comment:1 Changed 3 years ago by cehoyos

  • Keywords drawtext added
  • Priority changed from normal to wish

What metadata are you referring to? / Please provide a sample input file.

comment:2 Changed 3 years ago by jlubeck

I don't know if meta data is the right word. I meant the information that any file has on an operating system. Like "Created Date", "Modified Date", etc

comment:3 Changed 3 years ago by cehoyos

Could you elaborate more on the use case? I thought what is interesting is the actual frame metadata of the file (like image creation time or image orientation or song name) and not information that the operating system provides for the file. Note that input generally does not have to be a file.

comment:4 follow-ups: Changed 3 years ago by jlubeck

Oh yes, actual frame metadata would be great if someone was getting pictures from an actual camera. It is not my actual use case though, but whoever handles this enhancement could go way past my personal requirement.

My current use case is that I made a script that captures a screenshot of my desktop every n seconds.

At the end of the day, all the screenshots are compiled into a video with FFMPEG.

What I would like is to print into the video the date/time of each frame.

comment:5 in reply to: ↑ 4 Changed 3 years ago by cehoyos

  • Component changed from avfilter to avformat
  • Keywords image2 added
  • Reproduced by developer set
  • Status changed from new to open
  • Summary changed from AVFilter: drawtext: Draw text with information of current image file to Export image2 file name as frame metadata
  • Version changed from unspecified to git-master

Replying to jlubeck:

Oh yes, actual frame metadata would be great if someone was getting pictures from an actual camera. It is not my actual use case though, but whoever handles this enhancement could go way past my personal requirement.

This works with current FFmpeg.

My current use case is that I made a script that captures a screenshot of my desktop every n seconds.

At the end of the day, all the screenshots are compiled into a video with FFMPEG.

What I would like is to print into the video the date/time of each frame.

This sounds as if it would be simpler to use ffmpeg for the screen capture.

Adding the current file name as frame metadata should fix your problem.

comment:6 follow-up: Changed 3 years ago by jlubeck

I'm sorry, I don't know if I understood you correctly. You say I can already do what I need?
Could you share an example?

Thank you very much for your help

comment:7 in reply to: ↑ 6 Changed 3 years ago by cehoyos

Replying to jlubeck:

I'm sorry, I don't know if I understood you correctly. You say I can already do what I need?

No, you don't want frame metadata (as you explained in comment:4) , you want the filename (which is available within the demuxer but not currently exported as metadata) or as an alternative other file information that is currently not available within ffmpeg.

comment:8 Changed 3 years ago by jlubeck

Oh, ok. Thanks for clearing that up. I figured later that the enhancement wouldn't still be open if I could do it now.

Thanks again!

comment:9 in reply to: ↑ 4 ; follow-up: Changed 3 years ago by EkriirkE

Replying to jlubeck:

Oh yes, actual frame metadata would be great if someone was getting pictures from an actual camera. It is not my actual use case though, but whoever handles this enhancement could go way past my personal requirement.

My current use case is that I made a script that captures a screenshot of my desktop every n seconds.

At the end of the day, all the screenshots are compiled into a video with FFMPEG.

What I would like is to print into the video the date/time of each frame.

I have a similar case; I have these cheap WiFi? security cameras that write jpgs to an FTP, the JPGs have the camera MAC, alias, and timestamp in the filename. It would be fantastic to get the source frame's file name overlaid on a compiled video.

comment:10 in reply to: ↑ 9 Changed 3 years ago by acidsoulbr

Replying to EkriirkE:

I have a similar case; I have these cheap WiFi? security cameras that write jpgs to an FTP, the JPGs have the camera MAC, alias, and timestamp in the filename. It would be fantastic to get the source frame's file name overlaid on a compiled video.

Looking for a way to use source frame's file name as overlay text, I found this proposal. I am exactly in the same case of having a cheap WiFi? security camera that writes jpgs to an FTP, the JPGs have the camera MAC address, alias (cam name), and timestamp of acquired image in the filename - all things that I would find cool to have in the overlay text.

comment:11 Changed 9 months ago by AlexSmith

  • Cc alexandre.schmidt@gmail.com added

comment:12 Changed 8 months ago by derobert

  • Cc anthony@derobert.net added
Note: See TracTickets for help on using tickets.