Opened 12 years ago

Last modified 3 years ago

#1452 reopened enhancement

image2 to support %t

Reported by: burek Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: image2
Cc: OmegaPhil@startmail.com, rogerdpack@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Parameter %t in the output file name (just like %d) could be used to store the time stamp info of the current frame being written in the file. It could follow the same syntax like %d for formatting.

It also might be used as an input parameter, but the list of matching input files would have to be sorted first, I guess, to have a correct sequence of input files.

Attachments (2)

0001-Added-the-option-to-extract-images-with-timecode-as-.patch (5.2 KB ) - added by marcusjohansson 6 years ago.
Fix for %t as timestamp
0001-Added-the-option-to-extract-images-with-timecode-as-v2.patch (5.1 KB ) - added by Alex 3 years ago.

Download all attachments as: .zip

Change History (13)

in reply to:  description comment:1 by Stefano Sabatini, 11 years ago

Component: undeterminedavformat
Keywords: image2 added
Status: newopen

Replying to burek:

Parameter %t in the output file name (just like %d) could be used to store the time stamp info of the current frame being written in the file. It could follow the same syntax like %d for formatting.

It also might be used as an input parameter, but the list of matching input files would have to be sorted first, I guess, to have a correct sequence of input files.

This looks a lot like #1969.

comment:2 by burek, 11 years ago

Yes, I guess the ticket #1969 is a duplicate of this ticket (this one was opened 7 months ago).

The idea is just to have a way to use the time stamps rather than the list of sequential numbers, in the input/output file name. The code for the input files might be a bit trickier than the code for the output output, but I guess it can be solved using file globing (replacing %t with *) or similar filtering.

comment:3 by Carl Eugen Hoyos, 10 years ago

Resolution: fixed
Status: openclosed
Version: unspecifiedgit-master

I believe this was implemented by Ramiro Polla in 454c89dd

in reply to:  3 comment:4 by Stefano Sabatini, 10 years ago

Resolution: fixed
Status: closedreopened

Replying to cehoyos:

I believe this was implemented by Ramiro Polla in 454c89dd

No, that commit allows to set the system time in the output file name, it's not the same as the timestamp, and only in the output.

comment:5 by OmegaPhil, 8 years ago

Cc: OmegaPhil@startmail.com added

comment:6 by Roger Pack, 8 years ago

Cc: rogerdpack@gmail.com added

comment:7 by Roger Pack, 8 years ago

Here is a github that at least started on it once, looks OK here:

http://stackoverflow.com/a/8953789/32453

by marcusjohansson, 6 years ago

Fix for %t as timestamp

comment:8 by Elon Musk, 5 years ago

Is this to support HH:MM:SS.XXX timestamps or pts timestamps?

comment:9 by Martin, 3 years ago

Last edited 3 years ago by Martin (previous) (diff)

comment:10 by Martin, 3 years ago

thanks

comment:11 by Alex, 3 years ago

I tried the old patch with new locations but first failed in building.
Part of this is because the patch locations are pretty old and another is that I know nothing about C.
I see that there were some API changes in APIchanges#L884

2016-04-11 - 6f69f7a / 9200514 - lavf 57.33.100 / 57.5.0 - avformat.h
  Add AVStream.codecpar, deprecate AVStream.codec.

which causes some errors in libavformat/img2enc.c for the line:

 AVCodecContext *codec = stream->codec;

But looking at this line I don't understand what the added AVCodecContext *codec was trying to do here since I don't see it referenced elsewhere.

I also came across this Changelog#L1236 line from 2011 which shows

  AVCodecContext deprecated. Codec private options should be used instead.

So I have no idea what that is about, considering that it's before this patch was created it can likely be ignored.

Removing that line all together did not cause any immediate issues AFAICT.
I was able to build it with a modified patch and tested with

ffmpeg -skip_frame nokey -i test.mp4 -vsync 0 -r 30 -f image2 thumbnails-%t.png

NOTE: There was a bug with the patch in that the first frame would be missing the timestamp.
I suspect this was caused by

if (ts < 1)
  goto fail;

So I changed the 1 to a 0.
This seemed to fix the issue with my command and hopefully has no negative implications but I don't promise anything.

Note: See TracTickets for help on using tickets.