[FFmpeg-user] Copying time stamp metadata

Moritz Barsnick barsnick at gmx.net
Wed Jul 25 14:59:13 EEST 2018


On Mon, Jul 23, 2018 at 10:56:59 -0700, Abhinav Kashyap wrote:
> I am trying to find out how can I copy timestamp related metadata from a
> file to another ?

The Unix filesystem timestamp is not considered as metadata by the
demuxer. You have to determine it with some other command (usually
"stat") and explicitly add it as metadata in the ffmpeg command line.

> 4) Copy metadata from original file to modified file using below command :
>    a) ffmpeg -i input.mkv -c copy -movflags +faststart output.mkv

"-movflags +faststart" has no effect for matroska (mkv) output.

>    b) fmpeg -i input.mkv -copyts -movflags +faststart output.mkv - This
> copies the video content as with all metadata including the start time.

"-copyts" copies timestamps, but as in video frames' timestamps, not
file system timestamps.

How about:
$ modtime=`stat -c %y .`; ffmpeg -f lavfi -i testsrc=d=1 -metadata "Modification Time=$modtime"

You need to figure out the correct format for your date, and the correct
metadata key name.

Cheers,
Moritz


More information about the ffmpeg-user mailing list