Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
487 views
in Technique[技术] by (71.8m points)

metadata - Converting video formats and copying tags with ffmpeg

I've been trying to convert some videos I took on my camera to a compressed format in order to save some storage space. I figured out how to use ffmpeg to convert the videos to the format I want, but what I haven't been able to figure out is how to copy the metadata. I'd like to copy the original metadata from when the video was taken (most importantly the creation time). I've tried running ffmpeg using the -map_meta_data 0:0 option, but that didn't seem to work. Any ideas?

It looks like the data I want to copy in this case is in the format section of the video. Using ffprobe with the show_format option, I get this output:

[FORMAT]
filename=video.AVI
nb_streams=2
format_name=avi
format_long_name=AVI format
start_time=0.000000
duration=124.565421
size=237722700
bit_rate=15267331
TAG:creation_time=2012-02-07 12:15:27
TAG:encoder=CanonMVI06
[/FORMAT]

I would like to copy the two tags to my new video.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Have a look at the documentation on dumping and loading metadata:

FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded INI-like text file and then load it back using the metadata muxer/demuxer.

The process might look something like this:

# First extract metadata
ffmpeg -i original.mov -f ffmetadata metadata.txt
# Next, transcode, including extracted metadata
ffmpeg -i original.mov -f ffmetadata -i metadata.txt compressed.mp4

I don't have a metadata-ful video to test with right now, but something like that should work.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...