VideoHelp Forum




+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 34
  1. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    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.
    Quote Quote  
  2. 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.
    Quote Quote  
  3. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    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!
    Quote Quote  
  4. Originally Posted by Radiobuzz View Post
    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.
    The subtitles could cause the compressed data to be very different.

    Originally Posted by Radiobuzz View Post
    Is there any software that would help me in doing this?
    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.
    Quote Quote  
  5. 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
    Quote Quote  
  6. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    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.
    Quote Quote  
  7. 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?
    Quote Quote  
  8. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    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
    Quote Quote  
  9. 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...
    Quote Quote  
  10. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    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).
    Quote Quote  
  11. 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 ?
    Quote Quote  
  12. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    Yup, unless you'll reverse-engineer it I suppose. I don't have the knowledge to do that.
    Quote Quote  
  13. Duck TrueMotion 1 (TM1) is the first video codec developed by The Duck Corporation. It uses differential pulse code modulation and interframe differencing.
    You will not be able to replace individual frames. At best, you'll probably have to replace whole GOPs.
    Quote Quote  
  14. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    . Well, thanks anyway. Does anyone have any other idea?
    Quote Quote  
  15. 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)
    Quote Quote  
  16. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    I'm sorry, I don't understand your questions.
    Quote Quote  
  17. 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.
    Quote Quote  
  18. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    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!
    Quote Quote  
  19. Originally Posted by Radiobuzz View Post
    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?
    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.
    Well how did you plan on doing the hex edit then? In order to do that you need a modifed version with altered translation. I.e. you need to encode a different version to copy FROM. But in order to ENcode you have to DEcode it first. If you can't decode it, how was your 1st plan even going to work?
    Last edited by poisondeathray; 28th May 2010 at 08:40.
    Quote Quote  
  20. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    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.
    Quote Quote  
  21. 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
    Quote Quote  
  22. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    No, I encode it using the older version. The new version is not compatible with the game.
    Quote Quote  
  23. 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
    Quote Quote  
  24. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    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.
    Quote Quote  
  25. See if you can cut/paste entire GOPs with VirtualDub in Direct Stream Copy mode.
    Quote Quote  
  26. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    Jagabo, do you mean that I should copy parts of the original video and then paste them on the subtitles version?
    Quote Quote  
  27. Originally Posted by Radiobuzz View Post
    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.

    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)
    Quote Quote  
  28. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    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.
    Quote Quote  
  29. But how does the re-encoded version look compared to the original? is it all pixellated and crappy? compression artifacts?
    Quote Quote  
  30. Member
    Join Date
    Jul 2007
    Location
    Argentina
    Search Comp PM
    No, the quality is not much different. Perhaps there's a small quality lost but it's not visible at least to my eyes.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!