Home All Groups Group Topic Archive Search About

Deflicker MPEG-2 video?

Author
22 Jul 2005 5:18 PM
MS
I have MPEG-2 video that I will burn to DVD. However, that MPEG-2 video
flickers a lot. (Captured from an old VHS tape made with a poor old analog
camcorder.) I am wondering about possibilities to take out the flicker.

I know of Avisynth and VirtualDub filters that reduce flicker, such as the
one by Donald Graft, another from MSU, etc. but those work in programs that
convert the video to AVI. Virtualdubmod can accept MPEG2 video as input, but
it will not output it.

I have a few programs that work with MPEG-2 video, including Ulead Video
Studio, and TMpgenc Plus. But I have not seen any filters in those programs
(please correct me if I missed something) that can improve a flicker
problem. Are there any programs that work with MPEG-2 video that can do
this? (Video Studio has brightness and sharpness filters, and special
effects, but I don't recall anything like deflicker.)

I guess it would be possible to convert the MPEG-2 video to AVI with
Virtualdubmod, using deflicker filters, then import that avi into Video
Studio to convert it back to MPEG-2. That would be very time-consuming, and
assuming one used some kind of compression in creating the AVI (to create it
uncompressed would require an incredible amount of space, which I don't
have), would involve multiple recompressions into different formats, which
is not good for the video. I would prefer to keep it encoded as is, as it is
already in DVD-compatible format, but improve the flicker problem.

Any suggestions?

Author
23 Jul 2005 4:57 PM
Will Dormann
MS wrote:
> I have MPEG-2 video that I will burn to DVD. However, that MPEG-2 video
> flickers a lot. (Captured from an old VHS tape made with a poor old analog
> camcorder.) I am wondering about possibilities to take out the flicker.
>
> I know of Avisynth and VirtualDub filters that reduce flicker, such as the
> one by Donald Graft, another from MSU, etc. but those work in programs that
> convert the video to AVI. Virtualdubmod can accept MPEG2 video as input, but
> it will not output it.

Open the video in VirtualDub-MPEG2 (or VirtualDubMod I believe), load
the anti-flicker filter, frameserve to your MPEG2 encoder of choice,
such as TMPGEnc.

No intermediate steps or temporary files.

http://www.videohelp.com/virtualdubframeserve.htm

--
-WD
Author
24 Jul 2005 1:13 AM
Karyudo
Show quote Hide quote
On Fri, 22 Jul 2005 10:18:57 -0700, "MS" <ms@nospam.com> wrote:

>I have MPEG-2 video that I will burn to DVD. However, that MPEG-2 video
>flickers a lot. (Captured from an old VHS tape made with a poor old analog
>camcorder.) I am wondering about possibilities to take out the flicker.
>
>I know of Avisynth and VirtualDub filters that reduce flicker, such as the
>one by Donald Graft, another from MSU, etc. but those work in programs that
>convert the video to AVI. Virtualdubmod can accept MPEG2 video as input, but
>it will not output it.
>
>I have a few programs that work with MPEG-2 video, including Ulead Video
>Studio, and TMpgenc Plus. But I have not seen any filters in those programs
>(please correct me if I missed something) that can improve a flicker
>problem. Are there any programs that work with MPEG-2 video that can do
>this? (Video Studio has brightness and sharpness filters, and special
>effects, but I don't recall anything like deflicker.)
>
>I guess it would be possible to convert the MPEG-2 video to AVI with
>Virtualdubmod, using deflicker filters, then import that avi into Video
>Studio to convert it back to MPEG-2. That would be very time-consuming, and
>assuming one used some kind of compression in creating the AVI (to create it
>uncompressed would require an incredible amount of space, which I don't
>have), would involve multiple recompressions into different formats, which
>is not good for the video. I would prefer to keep it encoded as is, as it is
>already in DVD-compatible format, but improve the flicker problem.
>
>Any suggestions?
>

No matter what you do, you'll have to re-encode. The most
space-efficient way to do that is:

Open MPEG-2 in DGIndex --> output D2V;
Write AVS to open D2V --> load in VirtualDubMod

So far what you've got is a way to open your MPEG-2 file in VDubMod
without any huge intermediate files, or the huge-ass wait VDubMod adds
when opening MPEG files.

Edit AVS (put in filters/functions/scripts) --> preview in VDubMod

When your script looks how you like it (e.g. your scripted video looks
flicker-free in VDubMod), then:

Load AVS in CCE or TMPGEnc --> MPEG-2

This will get you from MPEG-2 to MPEG-2 with no intermediate AVI
files, and (depending on your filters) one conversion from YV12 to RGB
(which is what CCE likes, as I recall) and one conversion/compression
from RGB back to YV12 (DVD-spec MPEG-2 is 4:2:0 YV12).

It's still unclear exactly what sort of flicker you're talking about,
but I don't need to know that in order to be pretty confident you
won't find a better route than what I've laid out. This is what all
the cool kids are doing, anyway...
Author
26 Jul 2005 12:00 AM
MS
Thank you, Karyudo and Will.

In the page at Videohelp that Will cited, a similar procedure is
recommended, however it involves using Vdubmod itself to frameserve the
video, rather than DGIndex. In that case one adds the filters, etc., before
doing the frameserving.

http://www.videohelp.com/virtualdubframeserve.htm  (page Will cited)


You suggest doing the frameserving first with DGindex to d2v, create an AVS
that opens the d2v, then open and edit the .AVS  in VDub (or vdubmod), then
open with the MPEG=2 encoder.

I think I missed a step though. You say open the .AVS in TMPGENC or other
MPEG-2 encoder. But the .AVS file was created in this case before vdub,
before the anti-flicker filter. After opening the .AVS file in VDUB(MOD) and
applying the filters, etc., how do you save it in vdub(mod), so that it can
be opened by the MPEG-2 encoder? Will Vdub save the .AVS, with its filters
added, rather than an .AVI? Or do you frameserve again with VDub after
applying the filter(s), which would mean frameserving twice?

To make my question simpler--using the procedure you outline below, after
editing, adding filters, etc. in vdub(mod), how do you save it in vdub(mod)
with the edits, for the MPEG-2 encoder to open?

Do you think that procedure will get better results than the one outlined in
the videohelp article?

I'm surprised that none of the MPEG-2 programs (that I've seen, at least)
have some sort of anti-flicker filter themselves.

You also wrote:

> "It's still unclear exactly what sort of flicker you're talking
about,...."

Well, of course, without you seeing the video, I wouldn't know how to
describe it to you. But if you have any suggestions regarding using
anti-flicker filters, good settings to try, etc., that could be helpful. I
have experimented with them a little before, but never really knew how to
set the settings, just experimented a little, etc. I find one problem with
them is that they can cause a washed-out effect, excessive brightness, at
certain points in a video . (Only at certain places, so one wouldn't want to
compensate by reducing brightness on the whole video.)

Have you had experience with the different Vdub deflicker filters? I have
tried two, the Donald Graft Deflick filter, and one called MSU Deflicker
(from Russia). I found the latter easier to use, as it does not require the
lengthy two-pass processing of the Graft Deflick filter. But I didn't really
know how to set the settings on either. If you can clarify anything about
how to use deflicker filters, that would be great!

Thanks again to both repliers! :-)

Show quoteHide quote
"Karyudo" <karyudo_use***@yahoo.com.remove.me> wrote in message
news:d2q5e1lfvac5nmhjrdpd08qk4qhrshvt9i@4ax.com...
> On Fri, 22 Jul 2005 10:18:57 -0700, "MS" <ms@nospam.com> wrote:
>
> >I have MPEG-2 video that I will burn to DVD. However, that MPEG-2 video
> >flickers a lot. (Captured from an old VHS tape made with a poor old
analog
> >camcorder.) I am wondering about possibilities to take out the flicker.
> >
> >I know of Avisynth and VirtualDub filters that reduce flicker, such as
the
> >one by Donald Graft, another from MSU, etc. but those work in programs
that
> >convert the video to AVI. Virtualdubmod can accept MPEG2 video as input,
but
> >it will not output it.
> >
> >I have a few programs that work with MPEG-2 video, including Ulead Video
> >Studio, and TMpgenc Plus. But I have not seen any filters in those
programs
> >(please correct me if I missed something) that can improve a flicker
> >problem. Are there any programs that work with MPEG-2 video that can do
> >this? (Video Studio has brightness and sharpness filters, and special
> >effects, but I don't recall anything like deflicker.)
> >
> >I guess it would be possible to convert the MPEG-2 video to AVI with
> >Virtualdubmod, using deflicker filters, then import that avi into Video
> >Studio to convert it back to MPEG-2. That would be very time-consuming,
and
> >assuming one used some kind of compression in creating the AVI (to create
it
> >uncompressed would require an incredible amount of space, which I don't
> >have), would involve multiple recompressions into different formats,
which
> >is not good for the video. I would prefer to keep it encoded as is, as it
is
> >already in DVD-compatible format, but improve the flicker problem.
> >
> >Any suggestions?
> >
>
> No matter what you do, you'll have to re-encode. The most
> space-efficient way to do that is:
>
> Open MPEG-2 in DGIndex --> output D2V;
> Write AVS to open D2V --> load in VirtualDubMod
>
> So far what you've got is a way to open your MPEG-2 file in VDubMod
> without any huge intermediate files, or the huge-ass wait VDubMod adds
> when opening MPEG files.
>
> Edit AVS (put in filters/functions/scripts) --> preview in VDubMod
>
> When your script looks how you like it (e.g. your scripted video looks
> flicker-free in VDubMod), then:
>
> Load AVS in CCE or TMPGEnc --> MPEG-2
>
> This will get you from MPEG-2 to MPEG-2 with no intermediate AVI
> files, and (depending on your filters) one conversion from YV12 to RGB
> (which is what CCE likes, as I recall) and one conversion/compression
> from RGB back to YV12 (DVD-spec MPEG-2 is 4:2:0 YV12).
>
> It's still unclear exactly what sort of flicker you're talking about,
> but I don't need to know that in order to be pretty confident you
> won't find a better route than what I've laid out. This is what all
> the cool kids are doing, anyway...
Author
26 Jul 2005 7:11 AM
Karyudo
Show quote Hide quote
On Mon, 25 Jul 2005 17:00:36 -0700, "MS" <ms@nospam.com> wrote:

>Thank you, Karyudo and Will.
>
>In the page at Videohelp that Will cited, a similar procedure is
>recommended, however it involves using Vdubmod itself to frameserve the
>video, rather than DGIndex. In that case one adds the filters, etc., before
>doing the frameserving.
>
>http://www.videohelp.com/virtualdubframeserve.htm  (page Will cited)
>
>
>You suggest doing the frameserving first with DGindex to d2v, create an AVS
>that opens the d2v, then open and edit the .AVS  in VDub (or vdubmod), then
>open with the MPEG=2 encoder.
>
>I think I missed a step though. You say open the .AVS in TMPGENC or other
>MPEG-2 encoder. But the .AVS file was created in this case before vdub,
>before the anti-flicker filter. After opening the .AVS file in VDUB(MOD) and
>applying the filters, etc., how do you save it in vdub(mod), so that it can
>be opened by the MPEG-2 encoder? Will Vdub save the .AVS, with its filters
>added, rather than an .AVI? Or do you frameserve again with VDub after
>applying the filter(s), which would mean frameserving twice?
>
>To make my question simpler--using the procedure you outline below, after
>editing, adding filters, etc. in vdub(mod), how do you save it in vdub(mod)
>with the edits, for the MPEG-2 encoder to open?

I think you've missed one fundamental point--one that I didn't make
explicit--and that is that AviSynth (.avs) more or less takes the
place of VDubMod's filters, and at the same time is quite a bit more
powerful and flexible. In my scenario, all you're using VDubMod for is
to preview the changes you're making in your AviSynth script. Your
anti-flicker filter will be a line (or several lines) in your AviSynth
script, rather than a filter that must be loaded each time in VDubMod.

AviSynth is a more robust workflow than VDubMod because you are
writing a script into which you can pile all kinds of stuff. You can
open more than one file, you can overlay this, use that as a mask,
animate something else. And you can rearrange filters or functions
pretty much at will. Sort of like it's a command-line version of
VDubMod, but on steroids.

Once your AVS script is looking how you like it, then you can open it
directly in the encoder, and AviSynth will get the frames directly
from the VOB (via DGIndex), and serve them to the encoder. I don't
believe there's any shorter path, other than opening an AVI file
directly. Clearly, if the encoder can open the AVS directly, there's
no need for the overhead of VDubMod's frameserving (and possible
colourspace conversions).

DGIndex takes a bit of time to work its magic, but what it does is
create a very small index file (.d2v) and the demuxed audio files
(.ac3, typically) that you can then drop into an AviSynth script. This
index file only needs to be written once. As far as I know, if you
close and re-open an MPEG file in VDubMod, you have to wait for it to
be parsed all over again each time. Which I figure is a pain.

>Do you think that procedure will get better results than the one outlined in
>the videohelp article?

Yes! If only because it is somewhat more flexible. For more info on
AviSynth, check Doom9.org's forums. You can also check the official
AviSynth Wiki at avisynth.org, which includes a download link and
quite a detailed manual for all the built-in functions. I think if you
take a look, you'll see that AviSynth is kind of on the next level up
from something like VDubMod when it comes to the actual processing of
stuff.

Once you get your AVS opened in VDubMod, be sure to use VDubMod's very
handy AviSynth script editor, which you'll find under Tools|Script
Editor (or CTRL+E). Using that, it's a one-button step to save and
reload and jump back to the frame you were looking at. You would not
believe how long it took me to find this incredibly useful feature...
Author
26 Jul 2005 8:14 AM
MS
Thanks again, Karyudo!

"Karyudo" <karyudo_use***@yahoo.com.remove.me> wrote in message
news:fanbe1dfl5panckmujdaejs81na6g1tups@4ax.com...

> I think you've missed one fundamental point--one that I didn't make
> explicit--and that is that AviSynth (.avs) more or less takes the
> place of VDubMod's filters, and at the same time is quite a bit more
> powerful and flexible. In my scenario, all you're using VDubMod for is
> to preview the changes you're making in your AviSynth script. Your
> anti-flicker filter will be a line (or several lines) in your AviSynth
> script, rather than a filter that must be loaded each time in VDubMod.

No, I didn't get that before. So, in your procedure Vdub(mod) really doesn't
do anything, except if one uses its script editor. In using vdub(mod) as a
preview, I find that it doesn't really play back videos well at all. But I
guess one might use it to get some idea, before going through with the
actual lengthy encoding. ( I put "mod" in parentheses, because in your
procedure, it could just as well be plain vdub (which has later versions
than the "mod" variation), as unlike the other procedure, it would only be
opening an .AVS file, not an .mpeg-2 file.)

Will TMPGENC open an .AVS file?

Your procedure sounds more difficult to do, especially since I'm not so
familiar with AviSynth, but I guess I could read up more on it. Of course I
could not use one of the deflicker filters I mentioned, as they are vdub
filters. I have seen one avisynth deflicker filter also, although I have
never tried it. (Also written by a Russian, but not MSU.) Have you used that
filter? What would be good settings to try with it?

I'll have to see if I will have enough time to do your procedure, which
would involve more study, learning more about AviSynth, etc., take more of
my time. But you might be right about it getting better results. I'll see
how my time shapes up.

(As far as the mpeg-2 file having to be re-parsed each time vdubmod opens
it, that's true, but wouldn't it only have to be opened onceby VDM, if one
followed the other procedure?)

Thanks again! :-)


Show quoteHide quote
>
> AviSynth is a more robust workflow than VDubMod because you are
> writing a script into which you can pile all kinds of stuff. You can
> open more than one file, you can overlay this, use that as a mask,
> animate something else. And you can rearrange filters or functions
> pretty much at will. Sort of like it's a command-line version of
> VDubMod, but on steroids.
>
> Once your AVS script is looking how you like it, then you can open it
> directly in the encoder, and AviSynth will get the frames directly
> from the VOB (via DGIndex), and serve them to the encoder. I don't
> believe there's any shorter path, other than opening an AVI file
> directly. Clearly, if the encoder can open the AVS directly, there's
> no need for the overhead of VDubMod's frameserving (and possible
> colourspace conversions).
>
> DGIndex takes a bit of time to work its magic, but what it does is
> create a very small index file (.d2v) and the demuxed audio files
> (.ac3, typically) that you can then drop into an AviSynth script. This
> index file only needs to be written once. As far as I know, if you
> close and re-open an MPEG file in VDubMod, you have to wait for it to
> be parsed all over again each time. Which I figure is a pain.
>
> >Do you think that procedure will get better results than the one outlined
in
> >the videohelp article?
>
> Yes! If only because it is somewhat more flexible. For more info on
> AviSynth, check Doom9.org's forums. You can also check the official
> AviSynth Wiki at avisynth.org, which includes a download link and
> quite a detailed manual for all the built-in functions. I think if you
> take a look, you'll see that AviSynth is kind of on the next level up
> from something like VDubMod when it comes to the actual processing of
> stuff.
>
> Once you get your AVS opened in VDubMod, be sure to use VDubMod's very
> handy AviSynth script editor, which you'll find under Tools|Script
> Editor (or CTRL+E). Using that, it's a one-button step to save and
> reload and jump back to the frame you were looking at. You would not
> believe how long it took me to find this incredibly useful feature...
>
>
Author
29 Jul 2005 3:53 AM
Karyudo
On Tue, 26 Jul 2005 01:14:11 -0700, "MS" <ms@nospam.com> wrote:

>( I put "mod" in parentheses, because in your
>procedure, it could just as well be plain vdub (which has later versions
>than the "mod" variation), as unlike the other procedure, it would only be
>opening an .AVS file, not an .mpeg-2 file.)

Correctamundo. However, I don't believe VDub non mod has the nifty AVS
editing feature built in, which for me is (now) essential.

>Will TMPGENC open an .AVS file?

Uhh... I've never tried it. CCE will...

>Your procedure sounds more difficult to do

True. But it's definitely more powerful, portable, and repeatable.

>Of course I
>could not use one of the deflicker filters I mentioned, as they are vdub
>filters.

Ah, but AviSynth can open just about every VDub filter, too! Not quite
as easily, but it can be done. But, to answer your next couple of
questions, no, I've never used it, so I have no idea about decent
settings to try.

>But you might be right about it getting better results.

The end result might be the same in both cases, but I find the fact
that I can save and close and do something else and then come back to
pretty much *precisely* where I was is a strong point in favour of
AviSynth. That, and I find it much easier to make small changes in
filters, etc.

>(As far as the mpeg-2 file having to be re-parsed each time vdubmod opens
>it, that's true, but wouldn't it only have to be opened onceby VDM, if one
>followed the other procedure?)

I'm confused as to which procedure you're talking about. With my AVS
strategy, once DGIndex is done, then you've basically got the loading
speed of an AVI ever after. From bitter experience, that doesn't seem
to be true when opening MPEG2 directly in VDubMod.

>Thanks again! :-)

You're welcome.
Author
8 Aug 2005 9:11 AM
Wilbert Dijkhof
Karyudo wrote:
Show quoteHide quote
>
> On Tue, 26 Jul 2005 01:14:11 -0700, "MS" <ms@nospam.com> wrote:
>
> >( I put "mod" in parentheses, because in your
> >procedure, it could just as well be plain vdub (which has later versions
> >than the "mod" variation), as unlike the other procedure, it would only be
> >opening an .AVS file, not an .mpeg-2 file.)
>
> Correctamundo. However, I don't believe VDub non mod has the nifty AVS
> editing feature built in, which for me is (now) essential.
>
> >Will TMPGENC open an .AVS file?
>
> Uhh... I've never tried it. CCE will...

Yes it will. If it doesn't you have to make some tweaks:

http://www.avisynth.org/Section+2%3A+AviSynth+and+frameserving#q2.4

Wilbert