使用ffmpeg转换视频格式和复制标签 [英] Converting video formats and copying tags with ffmpeg

查看:306
本文介绍了使用ffmpeg转换视频格式和复制标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将我在相机上拍摄的一些视频转换为压缩格式,以节省一些存储空间。我想出了如何使用ffmpeg将视频转换为我想要的格式,但是我还没有想到的是如何复制元数据。我想从拍摄视频(最重要的是创作时间)复制原始元数据。我尝试使用-map_meta_data 0:0选项运行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?

在这种情况下,我想要复制的数据看起来是视频的格式部分。使用ffprobe与show_format选项,我得到这个输出:

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.

推荐答案

看看有关转储和载入元数据的文档


FFmpeg能够将媒体文件中的元数据转储成一个简单的UTF-8编码的类似INI的文本文件,然后使用元数据muxer / demuxer加载它。 / p>

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.

过程可能如下所示:

# 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.

这篇关于使用ffmpeg转换视频格式和复制标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆