压缩 AVI 视频流,同时盲目复制另一个流

发布于 2024-11-18 17:40:48 字数 477 浏览 5 评论 0原文

我有一堆格式有点奇怪的视频文件。有一个常规视频流,还有一个文本流,用于存储视频帧的精确时间戳(来自 GPS 同步硬件时钟)。以下是 ffmpeg 的输出示例:

Input #0, avi, from 'in.avi':
  Duration: 00:00:52.13, start: 0.000000, bitrate: 311033 kb/s
    Stream #0.0: Video: rawvideo, rgb32, 658x492, 30 tbr, 30 tbn, 30 tbc
    Stream #0.1: Data: 0x0000

视频未压缩,因此我想对其进行压缩。我成功地使用 ffmpeg 来完成该部分。问题是,我想将数据流#0.1 映射到输出文件中,完全不变。我一直在尝试,但我找不到任何方法让 ffmpeg 做到这一点。它只想处理音频、视频和字幕流,并且文本不是有效的字幕格式。制作视频的人刚刚退休,因此更改输入格式不是一个选择。有什么想法吗?

I have a bunch of video files with a slightly weird format. There's a regular video stream, and there's also a text stream, which is being used to store precise time stamps of the video frames (from a GPS-synchronized hardware clock). Here's an example output from ffmpeg:

Input #0, avi, from 'in.avi':
  Duration: 00:00:52.13, start: 0.000000, bitrate: 311033 kb/s
    Stream #0.0: Video: rawvideo, rgb32, 658x492, 30 tbr, 30 tbn, 30 tbc
    Stream #0.1: Data: 0x0000

The video is uncompressed, so I want to compress it. I'm successfully using ffmpeg for that part. The problem is, I want to map the Data stream #0.1 into the output file, completely unchanged. I've been trying and trying, but I can't find any way to make ffmpeg do that. It only wants to deal with Audio, Video, and Subtitle streams, and the text is not in a valid subtitle format. The guy who made the videos just retired, so changing the input format is not an option. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

灯下孤影 2024-11-25 17:40:48

好吧,让我们考虑一下您在这里想要做什么:

  • 您想要节省空间并保持档案完好无损。崇高的想法。但是,视频文件有什么用呢?由于您的数据流位于 AVI 文件内,因此您似乎拥有一个可以读取该文件并对其执行某些操作的软件。那么,该软件能够读取压缩视频吗?
  • 视频帧速率是恒定的还是变化的?如果它是常数,您可以提取第一帧的时间,并在使用文件时以编程方式计算每帧的时间。
  • AVI 不会处理你想要做的事情。你可以拥有现在拥有的,因为视频帧和时间戳是一一对应的,当你的视频打包时,会有关键帧和其他视频数据,
  • 如果你不这样做 ,你将只能对关键帧加时间戳不需要软件来使用该文件,您可以考虑在视频帧中添加时间戳,并完全放弃您的数据流吗?

好吧,我本来不想回答,但你的问题太开放了。

编辑:我读到 AVI 文件确实具有恒定的帧速率,因此您可以真正使用第一种技术并将第一帧的时间戳写入某个文件。

Well, let's consider what you are trying to do here:

  • you want to save space and have your archive intact. Noble idea. But, what is the usage of the video files? Since you have your data stream inside the AVI file, it seems that you have a software that will READ that files and do something with them. So, is that software able to read COMPRESSED video at all?
  • is the video frame rate constant or is it changing? If it's constant, you can extract the time for the first frame, and programaticaly calculate time of each frame when the file is used.
  • AVI won't handle what you are trying to do. You can have what you have now because there is one-to-one correspondence from video frame to timestamp, when your video is packed, there will be KEYFRAMES and other video data, and you'll be able only to timestamp keyframes
  • if you don't need a software to USE the file, can you consider timestamping IN frame of the video, and completely ditch your data stream?

Well, I didn't want to answer with an answer, but your question is too open-ended.

EDIT: I am reading that AVI files ARE indeed of a constant framerate, so you can really use first technique and write timestamp of the first frame to some file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文