VideoHelp Forum




+ Reply to Thread
Results 1 to 28 of 28
  1. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    i was able to take a frame from an avi & open in photoshop & work on. how do i get that processed frame back into virtual dub to replace the unprocessed one?
    Quote Quote  
  2. VirtualDub isn't meant for that type of editing. You can use it for that but it will take many convoluted steps especially if your AVI file has audio.

    What codecs are used in your AVI file? Video AND audio, or just video?
    Quote Quote  
  3. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    it's yuv uncompressed avi 16bpp
    Quote Quote  
  4. That will be easier than something like Divx. No audio?

    Oh wait... It will be hard to find a still image format that will give you 16 bit YUV (YUY2?) when imported into VirtaulDub. You may be able to use AVISynth to convert a BMP file to YUY2 format for import into VirtualDub. I'll have to experiment with that.

    The basic procedure will be to save the part of the source video before the modified frame as one AVI file, the modified frame as second AVI file, then the the last portion of the source as a third AVI file. Finally, you will use VirtualDub's ability to append AVI segents together.
    Quote Quote  
  5. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    the original avi has sound. when i get through i will need audio back.i saved the video frame as a targa file .tga but i think i could have saved as .bmp. sorry but i'm a newbie
    Quote Quote  
  6. The easiest way way I found to do this, using just Virtualdub, involved converting the video to uncompressed RGB. This will make your files larger and you will lose a (very) little color accuracy. Since your video is uncompressed YUV I'll assume your audio is too. To make the instructions clearer, I'll assume frame 1000 is the frame you want to replace with a modified version.

    1) Open your original file with VirtualDub.

    2) Use the frame slider to move to the start of the file (frame 0). Press the Mark-in button.

    3) Move the frame slider to the frame you exported and modified, frame 1000. Press the Mark-out button.

    4) Save as AVI. Call it PART1.AVI. This will save from the Mark-in marker to the frame just before the Mark-out marker (frames 0 to 999).

    5) Move the frame slider to the frame after the modified frame, frame 1001. Press Mark-in.

    6) Move the frame slider to the end of the video. Press Mark-out.

    7) Save as AVI. Call this PART3.AVI. It will contain frames 1001 to the end of the file.

    8) Move the frame slider to the frame you exported, frame 1000. Press Mark-in.

    9) Move the frame slider to the next frame, 1001. Press Mark-out.

    10) Export the audio as a WAV file using File -> Save WAV. This saves the audio from frame 1000 for use below.

    11) Open your TGA file with File -> Open Video File.

    12) Verify the frame rate is the same as your original file, Video -> Frame Rate. In the top box, Source Rate Adjustment, if the line "No Change (current: xx.xxx)" is not the correct frame rate, mark the button underneath it, "Change To xx.xxx Frames Per Second", and set the frame rate.

    13) Import the WAV file created in step 10 using Audio -> WAV Audio.

    14) Use File -> Save as AVI and call it PART2.AVI. You now have the modified frame 1000 and it's audio in an AVI file.

    15) You now have three new AVI files, PART1.AVI (frames 0 - 999), PART2.AVI (frame 1000) and PART3.AVI (frames 1001 - end). You want to append them together.

    16) Use File -> Append AVI Segment to append. At the bottom of the file dialog checkmark the Autodetect Additional Segments By Filename option if it's not already checkmarked. Select PART2.AVI. PART3.AVI should automatically be appended after you press the Open button.

    17) Save as AVI will now save the whole thing.

    Obviously, this is a huge pain in the *ss. If you're going to be doing it often you should get a real video editing program.
    Quote Quote  
  7. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    which other program will do it? it would be nice if it allowed you do input & output avi or mpeg2
    Quote Quote  
  8. Hi-

    I'm pretty sure AviSynth can do it, and fairly easily. I was fooling around with sticking a picture into an MPEG and got it working with no problems. You may have some colorspace issues I don't understand. I made everything YUY2. You can make it RGB24 or YV12 or whatever you like, within reason. I used a BMP as a picture source, You can also use JPG or PNG. I'm not positive, but I don't think you can use TGA pics.

    One way to do this is to extract the audio and set it aside. Either remove the audio entirely from the AVI, or disable it with "False" as you'll see shortly. Add the audio back when done. You can process the audio along with the video, but for simplicity's sake, I avoided that. Open the script in VDub to test before encoding. Encode in VDub for AVI, or in CCE or whatever for MPEG-2. Say you want to replace frame 1000 with your pic:

    A=AVISource("C:\Path\To\Video.avi",False).ConvertT oYUY2().AssumeFPS(29.9700)
    B=ImageSource("C:\Path\To\ReplacePic.bmp",fps = 29.9700,End=0).ConvertToYUY2()
    C=A.Trim(0,999)
    D=A.Trim(1001,0)
    C+B+D

    Adjust for your paths, names, colorspace, framerate, etc.

    http://www.avisynth.org/AviSource
    http://www.avisynth.org/ImageSource
    http://www.avisynth.org/Trim
    http://www.avisynth.org/Splice
    http://www.avisynth.org/Convert

    By the way, you didn't say exactly why you wanted to replace the frame. I'm assuming it was corrupted or something like that. Maybe it would be easier just to replace it with an adjoining frame using the FreezeFrame command:

    http://www.avisynth.org/FreezeFrame
    Quote Quote  
  9. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    ok i have a total of 6921 frames. i want to replace 2260-2264. how would that be scripted in avisynth? would i need to use convert to yuy2 or something else? it is yuv. why can't i keep it as it is & then encode in que enc to dvd as the other unedited files that will go with this edited file? when you use false in avi source part it disables audio? how do you get it back in avisynth?
    Quote Quote  
  10. Oh, so now you're changing the requirements? Originally you asked:
    how do i get that processed frame back into virtual dub to replace the unprocessed one?
    What are you using to replace frames 2260-2264? 5 different pics, or the same pic 5 times? Either way it's easy. I (or someone else) just have to know what you want.

    As for colorspace, I chose YUY2 in the off chance you're encoding for DVD using CCE. Since you hadn't said at that point, then how was I to know what you're up to? Since the sources may have different colorspaces, I thought it best to make them all the same. Which it is doesn't really matter. If you're going for AVI using VDub(Mod), then maybe YV12 is better. If you're using TMPGEnc to encode, maybe RGB24 is better.

    why can't i keep it as it is & then encode in que enc to dvd as the other unedited files that will go with this edited file?

    I don't know what colorspace QuEnc requires. Maybe you do. But joining sources using different colorspaces is impossible. In order to join your pics of one colorspace to your AVI of a different one, the colorspaces have to be made the same. The best choice is the one your encoder uses. If you're asking if you can encode them separately (part1 before the pics, part2 being the pics, and part3 after the pics) and then join them when authoring, yes, that's possible.

    when you use false in avi source part it disables audio?

    Yes. That's what I said, isn't it?

    how do you get it back in avisynth?

    Why is it necessary that it be handled in AviSynth? I said it can be added back later. Anything wrong with that? Just extract it from the AVI, convert it if necessary for DVD and hold it until the authoring stage. Most authoring apps require elementary (i. e., separate) streams. The rest, as far as I know, accept elementary streams.
    Quote Quote  
  11. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    i appreciate any & all help you can give me. don't mean to make things hard for anyone but the simple fact is i'm a newbie though i've already learned a lot. i decided i needed to replace frames 2260-2264 instead of just 1. i'm taking each one of those frames out as a .bmp , importing in photoshop , taking out a horizontal green line running through & replacing so that the replacement is the same as original but without green line. i don't know what colorspace que enc uses. at this point i don't know how to check except i captured as yuv. i think that's the only colorspace 7800gt will capture. i was able to encode to dvd using que enc (with yuv) so i figure why rock the boat. i could have spent a lot of time trying to get the script you gave me to work with those 5 frames instead of the one but i thought it would be a lot quicker when you seem to know a lot more than me. by the way the frames are named 2260.bmp, 2261.bmp etc. thanks for any help you can give
    Quote Quote  
  12. Always Watching guns1inger's Avatar
    Join Date
    Apr 2004
    Location
    Miskatonic U
    Search Comp PM
    A=AVISource("C:\Path\To\Video.avi",False).ConvertT oYUY2().AssumeFPS(29.9700)
    B1=ImageSource("C:\Path\To\2260.bmp",fps = 29.9700,End=0).ConvertToYUY2()
    B2=ImageSource("C:\Path\To\2261.bmp",fps = 29.9700,End=0).ConvertToYUY2()
    B3=ImageSource("C:\Path\To\2262.bmp",fps = 29.9700,End=0).ConvertToYUY2()
    B4=ImageSource("C:\Path\To\2263.bmp",fps = 29.9700,End=0).ConvertToYUY2()
    B5=ImageSource("C:\Path\To\2264.bmp",fps = 29.9700,End=0).ConvertToYUY2()
    C=A.Trim(0,2259)
    D=A.Trim(2264,0)
    C+B1+B2+b3+b4+b5+D
    Worst case, you may need to adjust the trim statements a little to get the exact frames.
    Read my blog here.
    Quote Quote  
  13. resohed,

    You are probably aware that YUV is a different way of encoding color than RGB. Y is the grayscale portion of the picture, U and V are the color components. Most capture cards capture in the YUV colorspace because that is the way it is broadcast. But they don't normally capture using a Y, a U, and a V for each pixel. TV is broadcast with half the resolution for U and V. So most capture cards capture in something like YUY2 -- which is a specific arrangement of Y, U and V components. There are many different ways of encoding YUV video see the YUV Format section at:

    http://www.fourcc.org/

    As you can see, there a many ways your data might be encoded. All of your sources need to be in (or converted to) the same format. You can start by using GSpot or AVICodec to determine what FOURCC code the video has. Note that your encoder will probably accept any number of formats. And since you're going to MPEG2, YV12 (ConvertToYV12() rather than ConvertToYUY2() in AVISynth) would be a good choice (YV12 is used internally by MPEG encoders).

    A quick modification of manono's script for replacing 5 frames might look like:

    A=AVISource("C:\Path\To\Video.avi",False).ConvertT oYV12().AssumeFPS(29.9700)
    C=ImageSource("C:\Path\To\ReplacePic2260.bmp",fps = 29.9700,End=0).ConvertToYV12()
    D=ImageSource("C:\Path\To\ReplacePic2261.bmp",fps = 29.9700,End=0).ConvertToYV12()
    E=ImageSource("C:\Path\To\ReplacePic2262.bmp",fps = 29.9700,End=0).ConvertToYV12()
    F=ImageSource("C:\Path\To\ReplacePic2263.bmp",fps = 29.9700,End=0).ConvertToYV12()
    G=ImageSource("C:\Path\To\ReplacePic2264.bmp",fps = 29.9700,End=0).ConvertToYV12()
    B=A.Trim(0,2259)
    H=A.Trim(2265,0)
    B+C+D+E+F+G+H

    AVISynth also supports an ImageReader() command that will load a sequence of images. I'll leave it up to you to figure out the syntax but it will be something like:

    A=AVISource("C:\Path\To\Video.avi",False).ConvertT oYV12().AssumeFPS(29.9700)
    B=ImageReader(__arguments_in_here_).ConvertToYV12( )
    C=A.Trim(0,2259)
    D=A.Trim(2265,0)
    C+B+D

    Manono -- thanks for your AVISynth script. I suspected AVISynth had an function for reading still images but I didn't know its name.
    Quote Quote  
  14. Member gadgetguy's Avatar
    Join Date
    Feb 2002
    Location
    West Mitten, USA
    Search Comp PM
    Or another way...

    A=AVISource("C:\Path\To\Video.avi",False).ConvertT oYV12().AssumeFPS(29.9700)
    B=ImageReader("C:\Path\To\ReplacePic%d.bmp",fps = 29.97, start=2260, end=2264).ConvertToYV12()
    C=A.Trim(0,2259)
    D=A.Trim(2265,0)
    C+B+D

    QuEnc needs YV12
    "Shut up Wesley!" -- Captain Jean-Luc Picard
    Buy My Books
    Quote Quote  
  15. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    thanks a lot ya'll. i'll give it a try
    Quote Quote  
  16. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    getting a sylia script error parse error. i start up virtual dubmod. choose run script. select the .avi file from avesedit. this is it:

    A=AVISource("h:\video\gene\misery.avi",False).Conv ertToYV12().AssumeFPS(29.9700)
    B=ImageReader("h:\video\gene\hag photo\done\%d.bmp",fps = 29.97, start=2260, end=2264).ConvertToYV12()
    C=A.Trim(0,2259)
    D=A.Trim(2265,0)
    C+B+D

    could be i don't understand how the %d.bmp part works or does it have to be other than an .avi file
    Quote Quote  
  17. Use File -> Open Video File, not Run Script.
    Quote Quote  
  18. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    i get an error now saying couldn't locate decompressor fo yv12. only direct stream copy is avaliable for this video
    Quote Quote  
  19. Member gadgetguy's Avatar
    Join Date
    Feb 2002
    Location
    West Mitten, USA
    Search Comp PM
    When do you get the error? When you open the script or when you try to encode?
    "Shut up Wesley!" -- Captain Jean-Luc Picard
    Buy My Books
    Quote Quote  
  20. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    i go to open video file-select .avs file & click open-then the error pops up. i don't see anything load into virtualdubmod.
    Quote Quote  
  21. YV12 shouldn't be a problem with VirtualDubMod. You can try adding ConvertToRGB() or ConvertToYUY2() to your AVS script (although you shouldn't have to).
    Quote Quote  
  22. Won't installing the XviD codec take care of that, or am I thinking of something else?
    Quote Quote  
  23. Member gadgetguy's Avatar
    Join Date
    Feb 2002
    Location
    West Mitten, USA
    Search Comp PM
    Originally Posted by manono
    Won't installing the XviD codec take care of that, or am I thinking of something else?
    It won't hurt, but it shouldn't be necessary. The output from AviSynth is uncompressed. I'm not sure why VdubMod would have a problem with the YV12 colorspace, but Mod has not kept up with the latest base Vdub. You could try using Vdub 1.6 and see if that will open it, or do as jagabo suggested and try the ConvertTo options.
    "Shut up Wesley!" -- Captain Jean-Luc Picard
    Buy My Books
    Quote Quote  
  24. I suspect resohed has an old version of VirtualDubMod. See Q1.9 of this AVISynth doc:

    http://www.avisynth.org/Section+1:+About+AviSynth
    Quote Quote  
  25. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    ok that worked for sequential frames. what about say replacing frame: 202,203,338,345,363-365,1125. how would that look? or to replace 0-6 frames?
    Quote Quote  
  26. You should be able to extrapolate from the earlier AVISynth scripts.
    Quote Quote  
  27. Always Watching guns1inger's Avatar
    Join Date
    Apr 2004
    Location
    Miskatonic U
    Search Comp PM
    Nothing has changed except the trim points
    Read my blog here.
    Quote Quote  
  28. Member
    Join Date
    Jun 2006
    Location
    United States
    Search Comp PM
    i guess i'm not a very good extrapolationist. i got the individual frames to be replaced by using beginning & end as same frame as in the formula. but i had to run it for each individual frame that was not sequential. i'm sure there is an easier way. i tried repeating the formula for all the frames i wanted to change on 1 script but it ignored all but the first one. never did get it to change the first 6 frames
    Quote Quote  



Similar Threads

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