Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

 
Wysiwyg - How To Get What You See?, even for D- and M-frames?
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
Cela
Posted: May 10 2010, 09:31 AM


Member


Group: Members
Posts: 18
Member No.: 27492
Joined: 26-April 10



VirtualDub works WYSIWYG - what you see in the output pane you will get after 'Save as AVI' in the new file, except for D-frames and M-frames.
For D- and M-frames you do NOT get WYSIWYG, instead you get as described here:
QUOTE
VirtualDub help>Processing>Editing>Masking frames
A single frame or section of frames can be masked; this prevents the imagery from those frames from being used and instead forces reuse of the image of the last unmasked frame. In Direct mode, the masked frame data is deleted entirely and empty padding frames are written instead. However, in either case the audio is untouched, so the video simply appears to freeze for the duration of the masked range. This can be used either to remove single-frame glitches or to remove compressed frames that are damaged...
and loose sync with the untouched audio.

I would want VirtualDub to output the image which it displays in the output pane even for a D-frame or a M-frame, i.e. to (recursively) substitute the image of the previous frame for a D- or a M-frame. Thus, after 'Save as AVI" the new video should simply freeze at these frames and stay in sync with the untouched audio.

This should hold even in Direct mode for a K-frame only video, where some K-frames are marked as D- or M-frames.

How to replace a masked or a dropped frame by its previous frame?
 
     Top
stephanV
Posted: May 10 2010, 09:50 AM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



You shouldn't lose audio synch when masking frames. Can you describe a scenario where you do?

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
Cela
Posted: May 10 2010, 03:54 PM


Member


Group: Members
Posts: 18
Member No.: 27492
Joined: 26-April 10



My main concern is what I get in the new avi after 'Save as AVI' of an input avi which has occasional D-frames. Although 90 D-frames is not much in a 3 hour avi and hardly visible at all, but these 90 d-frames when skipped in a later processing step will add up to audio becoming up to 3 seconds too late (because video will be too short).

As an attempt for a workaround, I tried to mark the D-frames as M-frames, but after (Direct mode) output these frames are again D-frames in the resulting avi. When I enter the new avi into CCE via DirectShowSource the resulting DVD-compliant mpeg2 stream will be as much out of audio sync as there were D-frames in the original avi, which obviously get skipped by DirectShowSource.

I used the paragraph about the M-frames from the VirtualDub help because it describes what happens with M-frames in comparison to D-frames. My primary concern are the D-frames. I tried a workaround via M-frames but that did not work.

I like what I see in VirtualDub and would like to get it in the output avi: each D-frame replaced by its preceeding frame.
Then the new avi will have a duplicate frame spot at the place of the original D-frame. Then I can apply the avisynth script which replaces the second frame of the two duplate frames (which was the D-frame) by an (MVTools) interpolated guess for the original dropped frame.

Now you will tell me to avoid recording dropped frames in the first place. Be sure I do everything I can to avoid recording dropped frames.
But I have many avi files which were recorded with a third party recoding program and have occasional dropped frames. Not many, but enough for getting out of audio sync. And for music recordings audio is more important than the video, thus I would like to keep the good audio and to correct the video glitches.
Furthermore, all avi videos are recorded 'K-frame only' to allow frame accurate editing and using Direct mode for output.

A (at the side of the user) very work intensive workaround using only Direct mode 'Write as AVI' would be a 'manual user procedure' like this:
CODE
...
Let ns=0 be the frame number of the beginning of the avi;
While ns < length_of_avi-1
Find nd the frame number of the next D-frame;
Define a selection from ns to nd.
Write as Avi "clip_ns-nd.avi";
If nd < length_of_avi Then
Define a selection nd-1 to nd; // starts with the frame before the D-frame
Write as AVI "clip_nd-nd+1".avi; // on append the frame before the D-frame will replace the D-frame!
End_If;
Set ns=nd+1;
End_while;
...
And then a second 'procedure' for appending the previously written clips in the correct order (supported by the special filenames) and then 'Write as AVI', again in Direct mode to get the final avi, in which all D-frames are replaced by the respective preceding frames.

I am sure VirtualDub can do this much better!

P.S.
With my last problem I needed 3 very looooong posts to make myself understood (English is not my first language!). Then it took phaeron 1 line to communicate the perfect VirtualDub solution for my problem: VirtualDub.subset.AddRange(0, VirtualDub.video.length / 2)

If there was no more elegant solution, it would be necessary to know something like the VirtualDub.video.length of my last problem to automate the above outlined procedure with a VirtualDub script. But this time not returning the length of the video as frame number but the frame number of the next D-frame. Then the pseudocode line
"Find nd the frame number of the next D-frame;" could be written as
nd=VirtualDub....FrameNumberOfThe NextDroppedFrame;
 
     Top
stephanV
Posted: May 10 2010, 06:21 PM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



Masking is not at all intended for what you are trying to do with it. If you want D frames turned into normal frames you need to do a recompression with "preserve empty frames" disabled.

You mean DirectShowSource from Avisynth? Why are you not using AviSource? That will not cause these problems.

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
Cela
Posted: May 10 2010, 09:21 PM


Member


Group: Members
Posts: 18
Member No.: 27492
Joined: 26-April 10



QUOTE (stephanV @ May 10 2010, 06:21 PM)
Masking is not at all intended for what you are trying to do with it.
Yes, I regret to have mentioned M-frames. Please, let us concentrate on the D-frame issue!
QUOTE (stephanV @ May 10 2010, 06:21 PM)
If you want D frames turned into normal frames you need to do a recompression with "preserve empty frames" disabled.
I scetched a working procedure for 'K-frame only' AVIs, which does NOT need a recompression to achieve the goal and which can be manually done with VitrualDub's GUI, and I asked for an equivalent automated solution.
Into what normal frame gets a D-frame turned by the recompression procedure which you suggest? I would not be happy with an empty frame nor with a skipped frame!
QUOTE (stephanV @ May 10 2010, 06:21 PM)
You mean DirectShowSource from Avisynth? Why are you not using AviSource? That will not cause these problems.
Yes from Avisynth. Does this all mean
a. that there is no way to simply replace all D-frames by the image of the preceding frame?
b. there is no VirtualDub script function or other script element (comparable to VirtualDub.video.length) to get the frame number of the next D-frame (or some special value, e.g. length+1 to denote that there is no next D-fame within the length of the avi)?
So far I do not understand what else could be done with a D-frame than skip it.
From DirectShowSource I know for sure that it skips the D-frames and thus shortens the video, which I do not want to happen!
What, exactly will AviSource do to compensate for the D-frame?
To sum it up:
I started with the question 'WYSIWYG'? How to get for a D-frame what I can see for that D-frame in the output pane of the GUI (and guessed it to be the image of the preceeding frame). My guess may be wrong. That is one of the reasons why I ask in this forum. So, what does VirtualDub display when it displays a frame marked D-frame? Give me this into the output! Without recompression for 'K-frame only' AVIs.
 
     Top
phaeron
Posted: May 11 2010, 03:27 AM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



D frames, by definition, take up the same amount of time as a frame that would be filled in for it. Unless you are feeding the output to a program that doesn't read AVIs properly, there should be no difference in sync between the original stream with D frames and a reworked stream with duplicate frames put in its place.

Unfortunately, as said before, you cannot do this type of replacement without recompressing the stream. The padding frames represented by the [D] marker are the way that you insert duplicate frames into the video stream without recompression.
 
    Top
stephanV
Posted: May 11 2010, 07:03 AM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



QUOTE
Into what normal frame gets a D-frame turned by the recompression procedure which you suggest? I would not be happy with an empty frame nor with a skipped frame!

The frame that comes before the d-frame.

QUOTE
So far I do not understand what else could be done with a D-frame than skip it.

If D-frames should only be skipped then they wouldn't be needed in the first place. The point of a D-frame is to be a place holder in time without actually holding image data. This can be for example to not cause desynch when frame drops occur during capturing.

QUOTE
What, exactly will AviSource do to compensate for the D-frame?

It does the exact same thing as VirtualDub. It displays the first real frame before it.

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
Cela
Posted: May 11 2010, 04:22 PM


Member


Group: Members
Posts: 18
Member No.: 27492
Joined: 26-April 10



Again, your answers were much easier than my question! smile.gif
Thank you for your unexhaustable patience!
QUOTE (phaeron @ May 11 2010, 03:27 AM)
...D frames, by definition, take up the same amount of time as a frame that would be filled in for it. Unless you are feeding the output to a program that doesn't read AVIs properly, there should be no difference in sync between the original stream with D frames and a reworked stream with duplicate frames put in its place.
Unfortunately, as said before, you cannot do this type of replacement without recompressing the stream. The padding frames represented by the [D] marker are the way that you insert duplicate frames into the video stream without recompression.

QUOTE (stephanV @ May 11 2010, 07:03 AM)
...The point of a D-frame is to be a place holder in time without actually holding image data. This can be for example to not cause desynch when frame drops occur during capturing...
.AviSource ...It does the exact same thing as VirtualDub. It displays the first real frame before it.
Now I think I got it. May I summarize:
CODE
1. D-frames are place holders in time without actually holding image data.
2. It is up to the processing program what it does with the D-frame information:
2.1 VirtualDub GUI displays the first real frame before it.
2.2 AviSource returns the first real frame before it, thus producing a duplicate.
2.3 When fed by AviSource "Save as AVI" will write the duplicate frame instead of the D-frame .
2.3.1 ... Uncompressed in Direct mode (very long outputfile! )
2.3.2 ... Compressed in Full processing mode.
2.3.3 Unfortunately, Smart rendering mode did not work for me with AviSource input via AviSynth script.
In a nutshell: You can get replacement of all D-frames by duplicates if you serve the original avi by AviSynth script with AviSource (do not use DirectShowSource!).
Replacement of all D-frames with an interpolation of the neighbouring real frames via AviSynth script would be a typical application asking for 'smart rendering', only rendering the < 0.1% of Dropped frame replacements, not rendering the 99.9% of good frames.

But: 'Smart rendering' does not work with AviSource via AviSynth script. sad.gif
Though it works with the original avi.
So it cannot be the ffdshow encoder configuration, which is exactly the same as in the recording application (Xvid, FourCC XVID, one pass - average bitrate, 8000 kbps, I frame interval 1, all parameters default, Input all RGB, Output store to frames, Pixel aspect ratio 1:1).
If you want, I can send you my small example "D-frames_at_6_12.avi" in a "Dropped Frames.rar" (996 KB) including ffdshow encoder settings screenshots in a rtf file and the anticipated avisynth script. Is there a possibilty for an attachement in this forum? If not, then I could upload it to Rapidshare: http://rapidshare.com/files/386108999/Drop...pped_Frames.rar
It would be phantastic if the remaining 'Smart rendering' issue could be solved.
 
     Top
stephanV
Posted: May 11 2010, 05:07 PM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



You cannot use smart rendering with Avisynth ever because it presents the clip as an uncompressed video to VirtualDub. VirtualDub can only access the uncompressed frames, not the compressed ones from the file opened by AviSynth.

I'm not sure why you are taking this intermediate step though, since you can open AVS scripts in CCE?

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
Cela
Posted: May 12 2010, 10:25 AM


Member


Group: Members
Posts: 18
Member No.: 27492
Joined: 26-April 10



QUOTE (stephanV @ May 11 2010, 05:07 PM)
I'm not sure why you are taking this intermediate step though, since you can open AVS scripts in CCE?

Because I do all the editing, i.e. trimming, cutting, replacing selection, best of several recordings of same show, etc., in VirtualDub. VirtualDub is a phantastic editor! smile.gif As you may know. wink.gif
VirtualDub is in fact much better than most payware! I prefer it especially for simple, but efficient multi-file editing. Each file in its own instance of VirtualDub. Nice big video panes for each video. Very good for frame by frame comparisons. Excellent for finding the best selection you would want for a certain scene in the final output; Save as AVI into a temp project directory.
In a final step put the cue puzzle together by 'Open append' and finally Save as final AVI, in Direct mode, of course. You get the best out of your footage!

The final output of the VirtualDub editing steps is a master AVI which is the central hub for further options depending on which playing devices I desire to support: USB-disk media player, DVD-Player, PS3, AVCHD-Player, iPhone, Cowon O2, etc.
I can play it with my Popcorn Hour or any other playing device that plays AVIs directly from an USB disk.
Or I can transcode it to whatever output format, output media, storage or playing device I intend to support. For example, there may follow an AVS with Crop, Resize, AddBorders, etc. for transcoding by CCE (to mpeg2) or by MeGUI (to h.264) depending on the desired playing device. Or I may feed the AVI directly into the Badaboom CUDA transcoder. For AVCHD oriented processing I feed the AVI into the excellent multiAVCHD which allows very easy creation of nice chapter menus for quick navigation to points of interest within the video.

QUOTE (stephanV @ May 11 2010, 05:07 PM)
You cannot use smart rendering with Avisynth ever...
Now it needs creative imagination. What else could we do? Please have a look at my simple sample. It may tell a better story than my loooong postings! And remember, the real footage could have up to some 450,000 frames including some hundred normal frames which happen to be duplicates and including 10 to 100 (and in rare occasions more) Dropped frames.

The best solution would be if a kind developer could add an intrinsic VirtualDub GUI or script feature for D-frame handling, which would allow the user to ask for the following actions:
QUOTE
1.>For direct AVI input into VirtualDub Replace all D-frames by respective preceeding real frame in such a way that the result may be Saved as AVI in Direct mode or with Smart rendering of the small number of frames envolved in D-frame replacements.
2.>Enable and answer the user question: How many (if any) D-frames are in the active AVI? Put the answer also into the VirtualDub Log.
3.>Upon user request, Put a list of the frame number of each D-frame into the Log.
4. Save the Log automatically into a text file so that it is ready after normal or abnormal execution of VirtalDub. Make the Log filename unique for each VirtualDub session (e.g. by including the start time to the millisecond in the Log-filename)


Just a dream!
 
     Top
Cela
Posted: May 14 2010, 07:15 AM


Member


Group: Members
Posts: 18
Member No.: 27492
Joined: 26-April 10



QUOTE (Cela @ May 12 2010, 10:25 AM)
The best solution would be if a kind developer could add an intrinsic VirtualDub GUI or script feature for D-frame handling, which would allow the user to ask for the following actions:
QUOTE
1.>For direct AVI input into VirtualDub Replace all D-frames by respective preceeding real frame in such a way that the result may be Saved as AVI in Direct mode or with Smart rendering of the small number of frames envolved in D-frame replacements.
2.>Enable and answer the user question: How many (if any) D-frames are in the active AVI? Put the answer also into the VirtualDub Log.
3.>Upon user request, Put a list of the frame number of each D-frame into the Log.
4. Save the Log automatically into a text file so that it is ready after normal or abnormal execution of VirtalDub. Make the Log filename unique for each VirtualDub session (e.g. by giving it the name of the active AVI and including the start time to the millisecond in the Log-filename)

Just a dream!
Is this Feature Request a too big deal for a comment, e.g. No chance, forget it! / We put it to very end of our list (again no chance)! / Could be in a new version next year. ... ?

Feel free to transfer it into a more appropriate part of the forum, if necessary!
 
     Top
phaeron
Posted: May 15 2010, 08:00 PM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



You have already been told that #1 is not possible or useful. #2-#4 are a bit too specialized.
 
    Top
Cela
Posted: May 15 2010, 09:13 PM


Member


Group: Members
Posts: 18
Member No.: 27492
Joined: 26-April 10



QUOTE (phaeron @ May 15 2010, 08:00 PM)
You have already been told that #1 is not possible or useful. #2-#4 are a bit too specialized.
Yes, I have already been told that #1 is not possible via avisynth AVS. Agreed.
But, I have shown a GUI procedure where #1 sure is possible for direct AVI input.
I use this procedure whenever I interpolate for duplicate frames. It works well, but is tiresome manual work crying for automation!

I agree, with the limitations of sylia scripting it is not possible to automize it by scripting because of sylia's incompleteness. It is sure possible to automize the tiresome part of it by a combination of a C# program producing a sylia script. But the best way would be to automize it within VirtualDub.
Therefore it would need half an hour programming instead, either of the GUI or the VirtualDub internals, or to add the missing sylia methods (which I also mentioned in one of my posts).
I do not think that somebody who knows the internals of VirtualDub will need more time to pass in Direct mode that K-frame a second time to the output file buffer as replacement for the following D-frame, which he already has passed in Direct mode for itsself:
...K K K K D K K K K... <--- already done now! In Direct mode!
...K K K K K K K K K... <--- replace D-frame by K-frame! In Direct mode!
You have already the K-frame! No need for re-compression in Full mode!
Insert a second [K], delete the [D]! Impossible????
That is all I am talking about.
From what I learned, you will tell me that that is a bit too specialized. wacko.gif

Have a look at the multiAVCHD forum. You will see there that DeanK, the developer of multiAVCHD, doesn't take more than a couple of days to implement far more extensive and specialized user suggestions!

But thanks for your help.
I have learned here to help myself!
 
     Top
phaeron
Posted: May 16 2010, 06:05 PM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



Fine, have him do it then. I'm not going to bother justifying my development decisions with someone who is so selfish. Thread closed.
 
    Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
13 replies since May 10 2010, 09:31 AM Track this topic | Email this topic | Print this topic

<< Back to Advanced Video Processing