Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

Using creation_time to change filename

Discussions about problems encountered using ffprobe.
Forum rules
FFmpeg is in a state of perpetual development and we do not currently have the person power to backport fixes to official releases. As such, if you wish to query or report a bug, you must try with the latest development branch revision of FFmpeg to confirm the issue still exists. The latest FFmpeg can be downloaded from here: http://www.ffmpeg.org/download.html

Using creation_time to change filename

Postby martinweiss » Tue Dec 27, 2016 2:01 pm

Hi,

I have large bunch of family movies, where after a recent migration, all file metadata got screwed up (i.e. they now have file creation dates in the 1970s). The correct information is still there in the metadata, i.e. when I run ffprobe on a file, the data information in creation_time is correct.

So the question/plea is: how can I (preferably in batch mode or as a terminal command) use the creation_time from ffprobe to have that date added to the filename.

E.g. if the current file name is "video003.mp4" and the creation_time per ffmpeg is 2010-08-29, then it would be fantastic to find a way to rename the file to "2010-08-29_video003.mp4".

Thanks for any help/pointers.

Martin


I'm using ffprobe/ffmpeg on a Mac 10.12.2, ffprobe version 3.1.5, ffmpeg version 3.1.5
martinweiss
 
Posts: 1
Joined: Tue Dec 27, 2016 1:56 pm

Re: Using creation_time to change filename

Postby llogan » Tue Dec 27, 2016 6:55 pm

You can get the creation_time with:
Code: Select all
 ffprobe -loglevel error -show_entries format_tags=creation_time -of default=nw=1:nk=1 input.mp4

It will likely be in a format such as:
Code: Select all
2012-07-22T17:48:25.000000Z

You'll want to use an additional tool to parse this output to isolate the date. You can then use this info for the new file name.

Since not all inputs may have creation_time I recommend including an if/then statement to only rename if creation_time output exists.

If you need additional help I recommend asking at a Bash scripting forum since the ffmpeg/ffprobe specific parts are all we can help with here.
Get an answer more quickly by providing your actual ffmpeg command and the complete console output. Use the code button to format your command and output or your question will be ignored.
llogan
 
Posts: 2354
Joined: Fri Jan 25, 2013 9:47 pm
Location: Alaska


Return to ffprobe

Who is online

Users browsing this forum: No registered users and 1 guest