Compress AVI video stream, while blindly copying another stream
I have a bunch of video files with a slightly weird format. There's a regular video stream, and there's also a t开发者_如何学JAVAext 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?
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.
精彩评论