Hi all,
I have a question which I know it sounds crazy but trust me, the project I'm working for doesn't leave me with any other choice. My question is this, assuming you have two videos using the same codec and similar compression settings, would it be possible to edit hexadecimally one of them to copy data and paste it into the other? Example: you have video X and also you have video Y which have subtitles. Could I cut the frames of Y starting in the position where the subtitles are and paste them (hence, overriding) into X? This is, again, assuming both videos would use the same codec.
Thanks.
+ Reply to Thread
Results 1 to 30 of 34
-
-
It depends on the codecs used. Most high compression codecs don't encode each frame as a standalone object. Most frames only contain the changes from one frame to the next (or another nearby frame). So replacing frames would be very difficult to do. Even with codecs that encode each frame in its entirety (like HuffYUV and Lagarith.) you would really have to know what you are doing because along with the frame data there is the organization of the container which has to be adjusted. For example it's common for a "chunk" (a compressed frame) of video to included the length of the chunk. If the new frame isn't the same size as the last chunk you have to move the rest of the video to compensate. Then you have to include the new chunk length along with the frame data. The header usually has the full size of the video so you have to adjust the header. And there's often an index at the end of the file indicating where every frame is located within the file (for quick seeking). So you have to update all the entries in that too.
It wouldn't be too hard to do with uncompressed video though. Every frame is the same size so you can just cut and paste. -
Thanks for all the info! The codec I'm working with is very old, it only works with Windows 95. Regarding the chuck issue I don't think there should be a problem because like I said both videos are the same except that one is subtitled and the other is not. Is there any software that would help me in doing this?
Thanks again! -
The subtitles could cause the compressed data to be very different.
I use an old free hex editor from HHD Software.
http://www.hhdsoftware.com/
But there are lots of hex editors around.
VirtualDub has a hex viewer a nice AVI chunk view that will be useful if your files are AVI. But it doesn't let you edit the data. -
Yeah it sounds crazy. Are you sure there's no other way? Exactly what are you doing? Wouldn't it be easier just to hardsub video "x" ?
Even making your own subs would be 100x easier than hex editing
If it's not a sub, rather something else like part of some frames, it would be 100x easier compositing it with compositing software , than hex editing -
I'm sure Poison. I'll try to explain: I'm translating a very old video game which uses a very old codec. I've saved the videos the game uses to uncompressed AVIs, subtitle those videos (because I can't edit them without decompressing them first) and recompress them with the same codec. The result video is different from the original one (I suppose because the original was compressed using the raw video taken from tapes whilst I'm using an modified one) which prevents me to create a patch, hence complicating my possibilities to distribute the translation once is made. The codec only works on Windows 95 and also it uses a serial number so it would be impossible to me to distribute (if I could do that I could possibly make something using AviSynth for distribution). So I think this is the best solution: to make a patch that only applies the subtitle portion of the video into the original ones. Other than that I see no other choice but to distribute the whole game, which it would be illegal, or a huge patch which I'm trying to avoid.
-
are the videos "cut scenes" or part of the actual game ?
what do you mean the resulting video is different from the original? Is your codec different? What codec is it? What colorspace? -
It's part of the game. The game is an FMV game (full motion video) which means it's mostly made out of videos. What I mean about the videos is that when the company compressed the videos, their starting point were uncompressed images, whilst my starting point are decoded frames from the already processed video. I might be wrong but I do believe the result will always be different. The codec is this one: http://wiki.multimedia.cx/index.php?title=Duck_TrueMotion_1
-
I see, you're referring to generation loss from compression
duck is very old, it's on2 (the company before on2) , and the 2nd generation video is probably very low quality
So the videos are pre-rendered and the same? ie. Gameplay never changes the video content?
You're probably right, there is no other way, thanks for explaining
Good luck hex editing... -
I'm not sure what you mean. In any case the game can have different versions of the same video (the player opening a door for example). The game uses AVIs so it's not like the content is being generated (unless of course on the in-game scenes, which are a different subject).
-
Yes, that's what I mean. The content is pre-generated, but you might use them in different combinations. In other games, they might use .tga for wall textures, for example
It's probably unlikely that the game will be able to understand other codecs in AVI container ? -
Yup, unless you'll reverse-engineer it I suppose. I don't have the knowledge to do that.
-
Duck TrueMotion 1 (TM1) is the first video codec developed by The Duck Corporation. It uses differential pulse code modulation and interframe differencing.
-
How bad in quality is the 2nd generation encode? Is the compression that poor ?
Is the codec that you have that different, that you can't just do a swap of the video assets? (i.e. if you replaced the video with a different version using your modified codec, will it work) -
I was suggesting to replace the old AVI's with new AVI's. But if the entire game is composed of AVI's then you're essentially re-distributing the game?
Earlier you said it was "different". I assumed the differences were due to 2nd generation compression. An analogy would be taking an xvid/avi file and re-encoding that with xvid again - the 2nd generation is lower in quality. If you use enough bitrate, the quality loss might only be minimal and tolerable
You mentioned differences between the codec, the original vs. the one you are using to encode. What are those differences? It can't be that different, because even if you were going to do the hex swap, you still have to generate a version to "copy" from. -
Your right about redistributing the game (it's a 5 CD game). The difference between the videos is the fact that I'm compressing a video using decompressed frames of a video which has been compress early on, that's why the resulting file is different. The original ones have a bitrate of 1066. Do you think that if I use a higher value the difference would be smaller?
Regarding the codec, I believe it's the exact same version. As far as I know, it only has two versions: the one I'm using (the first one) and the second one. I also have the second one, which is able to decompress videos using the first version, but it's newer so the videos compressed using that one will not work on the game.
The only real problem with the codec is that for some reason is not able to decompress the videos. I mean, if I open a video directly from the game into VirtualDub all I see are red stripes, although I'm able to hear the audio. It's weird.
I could try the bitrate thing just to check! -
Yes, this is how lossy compression works. The higher the bitrate the less compression losses
e.g. if you have an mp3 192kb/s , and you re-encode a) to 128kb/s b) 256kb/s , (b) will sound a lot better than (a) but not as good as the 1st generation 192kb/s version (generation loss)
The problem is, you might hit filesize limitations - you can't just swap it on the CD because that has a fixed capacity (you might need 8 CD's for example to fit it all, that might not work with the way the game is programmed)
The only real problem with the codec is that for some reason is not able to decompress the videos. I mean, if I open a video directly from the game into VirtualDub all I see are red stripes, although I'm able to hear the audio. It's weird.Last edited by poisondeathray; 28th May 2010 at 08:40.
-
I am able to decode the videos using the second (newer) version of the codec. That's why I said earlier that I'm working with uncompressed videos.
-
and you can encode it using the new version, and it's compatible with the game?
when you uncompress, you don't lose quality. You lose quality when you re-compress. My question was how bad is the 2nd generation, and can you reduce the losses by using a higher bitrate
an analogy would be decompressing mp3 to wav, which is mathematically lossless. The losses are incurred when you re-encode using a lossy format again to mp3 -
No, I encode it using the older version. The new version is not compatible with the game.
-
I see, you decode to uncompressed using 2nd version. Then encode that uncompressed intermediate using 1st version?
How "bad" is the 1st version codec for encoding. Is the quality that bad?
Do you have slack space on the CD's or are they full capacity? That will determine how much more bitrate you can use -
Is not that bad of a codec, it's just that it is old so the compression is not great. For instance, the intro is 3 minutes long and the original video is about 30 MB. I could send you some samples if you want.
I'm trying the bitrate thing as we speak. There's a small problem which is that I don't know which codec's settings did the company used when first compressing the videos so I just experiment with them (is not that the codec have so many options either way). I'm using a great bitrate, more than 3000, and I used the settings to make the video have the highest quality but still my resulting video is a couple of MB smaller than the original one. -
See if you can cut/paste entire GOPs with VirtualDub in Direct Stream Copy mode.
-
Jagabo, do you mean that I should copy parts of the original video and then paste them on the subtitles version?
-
what was the original video bitrate? does that include audio?
if the encoder actually achieves the entered bitrate, and you included audio as well , that suggests you're using a LOWER bitrate than the original, since the filesize is smaller
filesize = bitrate x running time
Even if you were to do the hex edit copy + paste, you would be copying parts of that lower quality version into the original. So it would still be in your best interests to use a higher bitrate for your modified version (assuming the hex edit or GOP copy would work properly) -
The original bitrate according to VirtualDub is 1066. The video includes the audio but I leave that untouched. I've even went all the up to 10000 bitrate and still getting a smaller file. Perhaps I should experiment more with the codec's settings.
-
But how does the re-encoded version look compared to the original? is it all pixellated and crappy? compression artifacts?
-
No, the quality is not much different. Perhaps there's a small quality lost but it's not visible at least to my eyes.
Similar Threads
-
What's the best tool to cut/trip MKV videos?
By creamsoda in forum EditingReplies: 16Last Post: 4th Jan 2019, 15:36 -
Hexadecimal header and offset of a MPEG-2 Transport stream file?
By coconut83 in forum ComputerReplies: 1Last Post: 26th Oct 2010, 10:41 -
Videos converted skip and are cut off
By gdreger in forum SVCD2DVD & VOB2MPGReplies: 10Last Post: 28th Dec 2009, 15:12 -
Why do videos converted from FLV not behave nice in editors?
By resonatored in forum Newbie / General discussionsReplies: 5Last Post: 26th Apr 2009, 18:03 -
What is the best program to split/cut/edit HD videos ??
By ZaYoOoD in forum EditingReplies: 7Last Post: 7th Jun 2008, 15:55