FFMPEG - Get creation and/or modification date

巧了我就是萌 提交于 2021-01-28 12:04:50

问题


I'm trying hard to get the modification date from a MP4 file hosted on my server.

I tried the following library:

ffmpeg -i video.mp4

Without any luck. All I get is duration and a few other fields but I'm not able to get modification date. I tried ffprobe as well and it is not there either.

Any suggestions??

Thanks a lot


回答1:


I checked for you, and indeed, mp4 has a modification time entry in the MDHD, but it's not exported (see code). You can file an enhancement request to get this metadata feature added to FFmpeg, but right now it won't help you and you'll need another tool to read this field.




回答2:


Get creation_time with ffprobe:

ffprobe -v quiet input.mp4 -print_format json -show_entries stream=index,codec_type:stream_tags=creation_time:format_tags=creation_time

To view all tags:

ffprobe -v quiet input.mp4 -print_format json -show_entries stream_tags:format_tags

I can't find any reference to modification_time so consider using exiftool or mediainfo.




回答3:


If ffmpeg is not getting you the creation date metadata it simply may not be present in the file. The utility 'mediainfo' can show a lot more information, it may be worth investigating its output against your mp4s.




回答4:


A simpler alternative to aergistal in terms of output is

$ ffprobe -v quiet -select_streams v:0  -show_entries stream_tags=creation_time -of default=noprint_wrappers=1:nokey=1 input.mp4

which will just print the creation time like so:

2020-07-23T11:51:02.000000Z


来源:https://stackoverflow.com/questions/31541489/ffmpeg-get-creation-and-or-modification-date

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!