Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VirtualDub, VDubMod & AviDemux

Reply
 
Thread Tools Search this Thread Display Modes
Old 22nd August 2019, 12:23   #881  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 775
Quote:
Originally Posted by wonkey_monkey View Post
shekh,

Drag any YUV video onto VirtualDub2, add a levels filter (input 0-64, output 0-255) and it comes out all messed up:

https://i.imgur.com/YXOrHaT.png

It seems to be skipping every fourth pixel, or possibly repeating pixels.

The problem goes away if I untick "Operate in luma instead of RGB", or if the input is RGB itself.
Fixed some errors in levels, also added support for full range YUV (long annoying trouble).
__________________
VirtualDub2
shekh is offline   Reply With Quote
Old 22nd August 2019, 12:27   #882  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 775
albino

I made illustration about profiler: https://sourceforge.net/p/vdfiltermod/wiki/performance/

I also noticed and fixed performance issue with conversion to RGB (shown in the wiki page) but not sure if this is what you did. Hope it helps to find something specific.
__________________
VirtualDub2
shekh is offline   Reply With Quote
Old 22nd August 2019, 22:07   #883  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 23rd August 2019, 10:09   #884  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
Quote:
Originally Posted by shekh View Post
Added fp32 mode in filters (not much optimized):
So, new SDK ? (Even if i'm not using this for now).
BTW, what is the status of a potential interlaced flag in the FilterModPixmapInfo ?
__________________
My github.

Last edited by jpsdr; 23rd August 2019 at 10:12.
jpsdr is offline   Reply With Quote
Old 24th August 2019, 08:46   #885  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 775
Quote:
Originally Posted by jpsdr View Post
So, new SDK ? (Even if i'm not using this for now).
BTW, what is the status of a potential interlaced flag in the FilterModPixmapInfo ?
Not new, formats were added from build 42338:
kPixFormat_RGB_Planar
kPixFormat_RGB_Planar16
kPixFormat_RGB_Planar32F
kPixFormat_RGBA_Planar
kPixFormat_RGBA_Planar16
kPixFormat_RGBA_Planar32F

About adding flags: I'm sorry to tell, nothing changed yet
__________________
VirtualDub2
shekh is offline   Reply With Quote
Old 25th August 2019, 09:49   #886  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
Quote:
Originally Posted by shekh View Post
Not new, formats were added from build 42338:
kPixFormat_RGB_Planar
kPixFormat_RGB_Planar16
kPixFormat_RGB_Planar32F
kPixFormat_RGBA_Planar
kPixFormat_RGBA_Planar16
kPixFormat_RGBA_Planar32F
So, i just need to update my vdplugin.h with yours.
After, it's up to me in my plugins to eventualy add support.
For RGB planar, as it's something new in virtualdub2, is it the following ?
Code:
pxsrc=(VDXPixmapLayoutAlpha&)*fa->src.mpPixmapLayout;
pxsrc.pitch = pitch R
pxsrc.pitch2 = pitch G
pxsrc.pitch3 = pitch B
//////////
pxsrc=(const VDXPixmapAlpha&)*fa->src.mpPixmap;
pxsrc.data = R data pointer
pxsrc.data2 = G data pointer
pxsrc.data3 = B data pointer
Quote:
Originally Posted by shekh View Post
About adding flags: I'm sorry to tell, nothing changed yet
No big deal, i was just asking to know, it's not something i realy miss...

Anyway, thanks again for your work on VDub2 evolving.

EDIT
Forgot to ask about :
Code:
FilterModPixmapInfo* info = fma->fmpixmap->GetPixmapInfo((fa->dst).mpPixmap);
info->ref_r; // and g,b,a
What about their value in float mode ?
Does it matter ?
__________________
My github.

Last edited by jpsdr; 25th August 2019 at 11:17.
jpsdr is offline   Reply With Quote
Old 25th August 2019, 22:47   #887  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 775
Quote:
Originally Posted by jpsdr View Post
So, i just need to update my vdplugin.h with yours.
After, it's up to me in my plugins to eventualy add support.
For RGB planar, as it's something new in virtualdub2, is it the following ?
Code:
pxsrc=(VDXPixmapLayoutAlpha&)*fa->src.mpPixmapLayout;
pxsrc.pitch = pitch R
pxsrc.pitch2 = pitch G
pxsrc.pitch3 = pitch B
//////////
pxsrc=(const VDXPixmapAlpha&)*fa->src.mpPixmap;
pxsrc.data = R data pointer
pxsrc.data2 = G data pointer
pxsrc.data3 = B data pointer
Yes, you just need new formats constants and the order of planes is R,G,B,A as you guessed (A=data4/pitch4)

Quote:
info->ref_r; // and g,b,a
What about their value in float mode ?
Not used/undefined. This is meaningful only for 16-bit integer formats.
__________________
VirtualDub2
shekh is offline   Reply With Quote
Old 25th August 2019, 23:50   #888  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
Quote:
Originally Posted by wonkey_monkey View Post
VirtualDub2 behaves strangely with this AviSynth+ script:

Code:
blankclip(pixel_type="rgbaps")
invert
converttoyv12
It seems to paint nothing in the panes (redrawing problems are evident if you drag the panes around, plus they darken when the window loses focus).

If you change converttoyv12 to converttoy8, you get colourful garbage, which may indicate an AviSynth+ problem but I'm not sure (since I can't read the output of "info" to determine what colourspace I've ended up with), but the redrawing issue with converttoyv12 indicates some kind of trouble with VirtualDub2 not sensibly handling unexpected data.

----------------------------------------------

Edit: confusion abounds because converttoyv12/y8 don't actually change the bit depth, so the problem is just that VirtualDub2 doesn't display (or throw an error for) float data.
FWIW, anything FFmpeg-based supports reading floating-point RGB(A) and Y32 from AviSynth+ if it's newer than 2019-05-04 (like the build of mpv I posted in another thread). FFmpeg still can't do much with it beyond display it, but that's enough to happily play back and verify that you're getting correct output from AviSynth+.
qyot27 is online now   Reply With Quote
Old 14th September 2019, 21:51   #889  |  Link
nji
Registered User
 
Join Date: Mar 2018
Location: Germany
Posts: 201
Remove every n-th frame

Recently I discovered that some movies contain duplicate frames every n-th frame.
(This must have happened by changing the frame rate somehow.)
Now I wanted to remove that frames, but found no practical way.
There is no filter for that (maybe the filter interface doesn't allow to delete frames?),
and changing the frame rate by menu (video / frame rate...) does allow to remove
every n-th frame (by frame rate conversion to a specific fps) but
you cannot specify the "start frame" to remove.
So it happens that frames that contain information are removed,
while the duplicate frames are left in the stream. That is worse than before.

The only "solution" I found is to write all frames as image sequence,
then delete every n-th image, and re-read the remaining images.
Quite unpractical.

So my question:
Is there any solution how to do that task?
nji is offline   Reply With Quote
Old 14th September 2019, 23:29   #890  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 775
nji

I think there is RemoveFrames filter which can do the job.
https://github.com/jpsdr/Filtres_JPSDR

Yes technically removing frames is supported. I'm not sure about the resulting timing, can be tricky to keep sync with audio.
Are you sure there is a problem with the movies? It's possible the input driver assumes wrong fps and generates this defect.
__________________
VirtualDub2
shekh is offline   Reply With Quote
Old 15th September 2019, 08:59   #891  |  Link
albino
Registered User
 
Join Date: Jul 2019
Posts: 9
Quote:
Originally Posted by nji View Post
So my question:
Is there any solution how to do that task?
If the video is 29.97 and every 5th frame is duplicated, like ABCDD, then you can just use the built-in IVTC filter and set it to Reduce, Auto, Auto to remove the dupe frames and return it to its natural 23.976 state very easily. You might have to set the audio to Full Processing Mode to keep sync, but I'm not sure since I always have the audio set to Full Processing.

Last edited by albino; 15th September 2019 at 09:03.
albino is offline   Reply With Quote
Old 15th September 2019, 09:29   #892  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
nji
You can indeed try my Remove Frames filter.
If will remove Frames removed frames at the Offset position each Frames period frames.
Assuming your Offset doesn't change on the fly. The first frame is with Offset = 0.
So, for exemple with :
Frames removed = 1
Offset = 3
Frames period = 5
With the following input :
[0][1][2][3][4] [5][6][7][8][9] [10][11][12][13][14]
Will produce the following ouput :
[0][1][2][4] [5][6][7][9] [10][11][12][14]

Frames removed = 2
Offset = 2
Frames period = 6
With the following input :
[0][1][2][3][4][5] [6][7][8][9][10][11] [12][13][14][15][16][17]
Will produce the following ouput :
[0][1][4][5] [6][7][10][11] [12][13][16][17]
__________________
My github.
jpsdr is offline   Reply With Quote
Old 15th September 2019, 10:51   #893  |  Link
nji
Registered User
 
Join Date: Mar 2018
Location: Germany
Posts: 201
Thank you very much all three of you once again!

The cause of the "duplicated" frames probably is not the input driver,
as I get the effect not only in VD2, but also in the player,
and in different movies to different amount.

If I export it as image sequence, the "double frames" are not identical.
(The "content" of the two images is, but there are small differences in
the written png image blocks that show only in arithmetic difference) (?)

Moreover the occurrence of doubling is not always regulary, but sometimes
a kind of pattern. For example: Every second frame for about 10 frames,
and then one "no doubling" and then doubling every second again,
then a triple of duplicates, then again every second frame, ... (?)

IVTC
Thank you for the hint.
I never considered that so far.
That filter works well for the scenario you described (29,97 fps and every 5th),
and for another movie (30 fps and every 6th) it is an approvement
(although from time to time there are some new, "combed" frames).
But on the movie mentioned above (29 fps and every 2nd) it fails:
the lenght stays the same, but the fps is reduced only to 23,2 fps,
and there are still duplicated frames (less and more irregulary).

I installed jpsdr's filters now.
Try, also your other two IVTC filters.


When watching the original movies, the speed seems naturally (even for that
example above, when every second frame is doubled).

So my overall guess for the cause is some kind of frame rate conversion.

Still in my case of analyzing the movie frame by frame I have to consider
the doubling.
(Actually in all filters about time (For example: Determing the moving
parameters when DeShaking(3D) ...).
But if the pattern is not regulary (as above) then how to distinguish
a doubling from a real non-motion?
(Not for the first time I hope the devs of all that movie formats and
conversions roast in hell ;-)
nji is offline   Reply With Quote
Old 15th September 2019, 15:35   #894  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by nji View Post

If I export it as image sequence, the "double frames" are not identical.
(The "content" of the two images is, but there are small differences in
the written png image blocks that show only in arithmetic difference) (?)
But if source used lossy compression, they might supposed to be duplicates - the difference might be due to the compression as the codec tries compensate when accounting for motion vectors.

The other time this commonly happens is frame drops. Such as low quality recording devices, such as some phones

Are these theatrical movies, or "video" shot from users ?

Quote:

IVTC
Thank you for the hint.
I never considered that so far.
That filter works well for the scenario you described (29,97 fps and every 5th),
and for another movie (30 fps and every 6th) it is an approvement
(although from time to time there are some new, "combed" frames).
But on the movie mentioned above (29 fps and every 2nd) it fails:
the lenght stays the same, but the fps is reduced only to 23,2 fps,
and there are still duplicated frames (less and more irregulary).
There are other adaptive methods in avisynth you can try . Some have comb detection /removal built in, some as a second post process
poisondeathray is offline   Reply With Quote
Old 15th September 2019, 16:37   #895  |  Link
nji
Registered User
 
Join Date: Mar 2018
Location: Germany
Posts: 201
Quote:
Originally Posted by poisondeathray View Post
But if source used lossy compression, they might supposed to be duplicates - the difference might be due to the compression as the codec tries compensate when accounting for motion vectors.
In VD2 I exported to image sequence, using png (which is lossless).
I don't have enough knowledge of codec/ motion vectors to understand
how a (visual) duplicate frame has (not visual) small differences as image.

Quote:
Originally Posted by poisondeathray View Post
The other time this commonly happens is frame drops. Such as low quality recording devices, such as some phones

Are these theatrical movies, or "video" shot from users ?
All these are private taken movie from early family feast, unknown hardware/ conversion.

I don't know what "frame drops" actually mean. But there is no frame missing. If you remove the duplicate frame, the motions are fluently.



Quote:
Originally Posted by poisondeathray View Post
There are other adaptive methods in avisynth you can try . Some have comb detection /removal built in, some as a second post process
Up till know I was successful in not opening another new tin (avisynth). ;-)
nji is offline   Reply With Quote
Old 15th September 2019, 17:11   #896  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by nji View Post
In VD2 I exported to image sequence, using png (which is lossless).
I don't have enough knowledge of codec/ motion vectors to understand
how a (visual) duplicate frame has (not visual) small differences as image.
Not the PNG; I'm referring to the source .



Quote:
Up till know I was successful in not opening another new tin (avisynth). ;-)
You can ask for help in the avisynth subforum
poisondeathray is offline   Reply With Quote
Old 15th September 2019, 20:15   #897  |  Link
albino
Registered User
 
Join Date: Jul 2019
Posts: 9
Quote:
Originally Posted by nji View Post
All these are private taken movie from early family feast, unknown hardware/ conversion.
Sounds like these were taken with your phone then, in which case they're all Variable Frame Rate. In my experience Virtualdub can't really convert Variable Frame Rate to Constant Frame Rate without going completely out of sync. If your intention is to edit them, then you're probably much better off using something like ffmpeg or Handbrake and forcing them to CFR first before bringing them into Virtualdub.

If anyone knows of a Virtualdub method for fixing VFR and maintaining audio sync then I would be interested in it as well.
albino is offline   Reply With Quote
Old 15th September 2019, 21:28   #898  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 775
Quote:
Originally Posted by albino View Post
Sounds like these were taken with your phone then, in which case they're all Variable Frame Rate. In my experience Virtualdub can't really convert Variable Frame Rate to Constant Frame Rate without going completely out of sync. If your intention is to edit them, then you're probably much better off using something like ffmpeg or Handbrake and forcing them to CFR first before bringing them into Virtualdub.

If anyone knows of a Virtualdub method for fixing VFR and maintaining audio sync then I would be interested in it as well.
If it is old family archive, I doubt it was taken on phone. More likely some camcorder? Probably was interlaced as well?
__________________
VirtualDub2
shekh is offline   Reply With Quote
Old 15th September 2019, 21:29   #899  |  Link
nji
Registered User
 
Join Date: Mar 2018
Location: Germany
Posts: 201
No, the movies aren't taken by me, not by phone (but with some kind of consumer camera), not with variable frame rate, and not interlaced.
However - they are movies. ;-)

Last edited by nji; 15th September 2019 at 21:33.
nji is offline   Reply With Quote
Old 15th September 2019, 21:46   #900  |  Link
nji
Registered User
 
Join Date: Mar 2018
Location: Germany
Posts: 201
@jpsdr:

I analysed some more of the movies in question.

Sadly, the pattern of the duplicate frames sometimes is not regular.
A typical example is: Dupe every 6th frame.
For some dozens frame.
Then the dupe arises as 5th frame.
Then the period of 6 again.
This game several times in the movie.

==> can't use your fine Remove Frames filter.

If anything else fails ... try ffmpeg.
And indeed:
https://stackoverflow.com/questions/...plicate-frames

And it works!
But if the criterion to remove is content based:
How to distinguish dupes from non-motion?
My genius idea for that:
Having a close look at the audio stream (if present).
But: the audio is quite unimpressed at times with dupes.

The only possible solution seems for me a filter (like Remove Frames),
that combines both - contents comparison and frame number pattern, like:
"Remove duplicate frames that appear in most times (= "fuzzy logic") regulary."
This should do the job.

Last edited by nji; 15th September 2019 at 22:09. Reason: Added last paragraph
nji is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:23.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.