[FFmpeg-devel] [PATCH 1/2] img2: added support for %t output pattern
Roger Pack
rogerdpack2 at gmail.com
Wed Nov 2 17:40:39 EET 2016
On 11/1/16, James Almer <jamrial at gmail.com> wrote:
> On 10/25/2016 9:38 PM, Roger Pack wrote:
>> From e8cac5c7de18766ce0f8f286f7dc140b82129df2 Mon Sep 17 00:00:00 2001
>> From: rogerdpack <rogerpack2005 at gmail.com>
>> Date: Tue, 25 Oct 2016 18:33:12 -0600
>> Subject: [PATCH 1/2] img2 encoder: allow %t in filename, based on patch
>> from
>> Yuval Adam
>>
>> Signed-off-by: rogerdpack <rogerpack2005 at gmail.com>
>> ---
>> doc/muxers.texi | 13 +++++++++++++
>> libavformat/avformat.h | 3 ++-
>> libavformat/hlsenc.c | 6 +++---
>> libavformat/img2enc.c | 6 ++++--
>> libavformat/utils.c | 42 ++++++++++++++++++++++++++++++++++++++----
>> 5 files changed, 60 insertions(+), 10 deletions(-)
>>
>> diff --git a/doc/muxers.texi b/doc/muxers.texi
>> index 0d856db..0c3a198 100644
>> --- a/doc/muxers.texi
>> +++ b/doc/muxers.texi
>> @@ -619,6 +619,12 @@ If the pattern contains "%d" or "%0 at var{N}d", the
>> first filename of
>> the file list specified will contain the number 1, all the following
>> numbers will be sequential.
>>
>> +If the pattern contains "%t", the frame's timestamps will be inserted
>> +in the filename like "00.00.00.000" for hours, minutes, seconds,
>> +and milliseconds.
>> +
>> +The "%t" and "%d" patterns may be used simultaneously.
>> +
>> The pattern may contain a suffix which is used to automatically
>> determine the format of the image files to write.
>>
>> @@ -664,6 +670,13 @@ can be used:
>> ffmpeg -f v4l2 -r 1 -i /dev/video0 -f image2 -strftime 1
>> "%Y-%m-%d_%H-%M-%S.jpg"
>> @end example
>>
>> +The following example uses the timestamp parameter to generate one
>> +image file per video frame from the input, and name it including its
>> original
>> +timestamp.
>> + at example
>> +ffmpeg -i in.avi -vsync vfr -copyts img-%t.jpg
>> + at end example
>> +
>> @subsection Options
>>
>> @table @option
>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>> index f9f4d72..7f39698 100644
>> --- a/libavformat/avformat.h
>> +++ b/libavformat/avformat.h
>> @@ -2780,10 +2780,11 @@ void av_dump_format(AVFormatContext *ic,
>> * @param path numbered sequence string
>> * @param number frame number
>> * @param flags AV_FRAME_FILENAME_FLAGS_*
>> + * @param ts frame timestamp in AV_TIME_BASE fractional seconds.
>> * @return 0 if OK, -1 on format error
>> */
>> int av_get_frame_filename2(char *buf, int buf_size,
>> - const char *path, int number, int flags);
>> + const char *path, int number, int flags,
>> int64_t ts);
>
> Uhh, what? did you just break API modifying a public function?
Yes, it was a recently added method so I hoped to get it "included"
before a version was released (but it took so long it maybe missed a
deadline...?)
Cheers!
-roger-
More information about the ffmpeg-devel
mailing list