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.

Pages: (2) [1] 2  ( Go to first unread post )
How To Crop & Use Fast Recompress?
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
AEN007
Posted: Nov 22 2008, 07:45 PM


Advanced Member


Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08



22Nov2008
Greetings.
I used to use the VDub Full processing,
a resize filter & the DivX codec to generate my video files.
I have recently discovered the advantage of using
Fast recompress instead of Full processing;
however, I do not know how to do resizes or cropping
when using Fast recompress. I have begun fooling around
with aviSynth with no success. Could some/any one reply
and advise how to use aviSynth & VDub with Fast recompress
to do cropping and/or resizing (& etc)?
Any insights/replied appreciated.
Thank you.
Regards,
AEN
Æ
 
     Top
IanB
Posted: Nov 22 2008, 10:50 PM


Avisynth Team Member


Group: Members
Posts: 121
Member No.: 22295
Joined: 23-October 07



Fast recompress mode is about directly connecting the input source stream to the compression codec without any slow intervening filters or colour space converters.

This is useful with Avisynth as it allows data to be processed completely in either YUY2 or YV12 format.

Here is a typical Avisynth script to crop and resize :-
CODE
AviSource("File.avi")
Crop(4, 2, -4, -10) # Must be even numbers for YUV formats.
Spline16Resize(640, 480)

Because the chroma data is subsampled the crop amounts must be even numbers. (H & V for YV12, H only for YUY2)

However the family of inbuilt resize filters accept optional input crop parameters which are not restricted by format. Thus you can do this :-
CODE
AviSource("File.avi")
Spline16Resize(640, 480, 5, 3, -3, -9)


Also note recent Virtualdub versions can process directly in YUV format in full processing mode. Specify the Decompression format and output format desired by setting the options in Video->Color Depth.

Selecting 4:2:0 planar YCbCr (YV12) for both formats is similar to using the Avisynth approach.

Note:- Virtualdub will silently add colour space converters to the processing graph to satisfy the input needs of any filters you use. Look for the [C] in the left column of the Filters dialogue window to see this happening, also set the Show image formats option to identify the conversion.

Cropping by non-even amounts cause a conversion to an internal 4:4:4 planar (YV24) format and a convert back on output.
 
     Top
AEN007
Posted: Nov 23 2008, 11:29 AM


Advanced Member


Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08



23Nov2008
Greetings.
Many thanks for the reply.
I now have more questions, but
I suppose I'll not ask them all at once.
My first problem was that I didn't know
to use File Open instead of Run Script.
I found that answer through internet searches.

My immediate question is the following-
How would one crop an input that
one really only wants to crop & then "Direct stream copy"?
What does one do after running a 2 line avs script?
AviSource("File.avi")
Crop(22,0,-22,0) # Must be even numbers for YUV formats
I ran the above & then tried a Direct Stream Copy save
on a 10 minute test stream, & the output was 8gb.
I ran the above & then tried a Fast recompress save
with DixX 6.8.5 @ a 501 video bit rate
on a 5 minute test stream, & the output was 160.7mb.

Any insights/replied appreciated.
Thank you.
Regards,
AEN
Æ
 
     Top
IanB
Posted: Nov 23 2008, 11:05 PM


Avisynth Team Member


Group: Members
Posts: 121
Member No.: 22295
Joined: 23-October 07



QUOTE (AEN007 @ Nov 23 2008, 10:29 PM)
23Nov2008
Greetings.
Many thanks for the reply.
I now have more questions, but
I suppose I'll not ask them all at once.
My first problem was that I didn't know
to use File Open instead of Run Script.
I found that answer through internet searches.

Yes Avisynth is a synthetic AVI file, you need to Open it.

The Run Script is to execute VirtualDub Sylia job control scripts.


QUOTE
My immediate question is the following-
How would one crop an input that one really only wants to crop & then "Direct stream copy"?

Under normal circumstances this is not possible. However there are limited tricks one can pull by editing the header of the AVI file, but that only allows cropping the right side and the bottom edge.

QUOTE
What does one do after running a 2 line avs script?
CODE
AviSource("File.avi")
Crop(22,0,-22,0) # Must be even numbers for YUV formats

I ran the above & then tried a Direct Stream Copy save on a 10 minute test stream, & the output was 8gb.

Avisynth always decompresses the source, applies your edits and then serves uncompressed data to the parent application. Uncompressed video data is very big, you need to recompress the cropped image.

QUOTE
I ran the above & then tried a Fast recompress save
with DixX 6.8.5 @ a 501 video bit rate
on a 5 minute test stream, & the output was 160.7mb.

Seems about right for 501 Kbytes/sec (501*5*60/1024=146.7Mb+OH).

But is 501 Kbytes/ses an appropriate data rate for your material? Choosing the right compression is quite a personal preference thing. Many people seem to settle around the 1200 Kbits/sec for 640x480 Xvid's i.e. 150 Kbytes/sec

 
     Top
AEN007
Posted: Dec 6 2008, 10:52 PM


Advanced Member


Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08



6Dec2008
Greetings.
Thanks for the reply.
I have some technical questions that I'd (eventually) like to ask,
but it seems opportune to reply about the video bit rate (VidBR)
and resulting output file size. I've been keeping stats for years
on every I/O I've processed in VirtualDub. The intervening goal
has been to create a table that will tell me how many megabytes
per minute I can expect at any given VidBR. Ultimately I'd like to
extrapolate from the data to a (precise or accurate) formula.
160mb or 146+OHmb for a 5 minute clip is totally (it seems to me)
incorrect for a 501 VidBR. After dozens & dozens of encodings
at 501, I've established that the expected MB/min is 4.08xxxx.
(I always export/improve the original audio & then use
my new wave file as the source audio for the encoding.)
This 4.08xxxx is of course contingent not only on a constant
audio encoding standard but all other variables/settings
on my computer(s). 160mb for a 5min clip is 32mb/minute!!!!

I've rerun tests after opening an .avs file.
Now the test results are in line with a 4.08xxxx VidBR @ 501.
(501 is sort of the absolute low-end I found that can generate
more than acceptable quality for "low motion" videos.)
I suppose the 160mb output result might be related to a new
problem I've encountered with VDub. I always set the frame rate
to "change so video & audio durations match".
(I always export/improve the original audio & then use my new
wave file as the source audio for the encoding.)
The problem I've encountered is that SOMETIMES when I leave
the frame rate conversion setting at "Process all frames",
the resulting avi output file is encoded incorrectly &
comes out super huge. Has anybody else encountered this issue?
I would of course like to hear from anyone
who knows more than me about this issue.
I don't know why this output encoding error occurs SOMETIMES
when I leave the frame rate conversion setting
at "Process all frames". If I then redo the encoding & set
the "Convert to fps" to 29.97 or 25.000 or whatever,
the resulting output is problem free.

It leaves me incredulous that there is no way to do a crop &
direct stream copy ... It seems to me that must be a commonly
needed video editing operation ... Isn't there some way to do it?
What is the known relationship between video re-encodings?
That is, it seems to me that cropping & re-encoding a video file
that was originally encoded at, say, 584 would not be the same
as doing a direct stream copy; however, I've not noticed any
quality loss in any of the test outputs I've generated so far.
I would of course like to hear from anyone
who knows more than me about this issue.

In any case I would also like to hear from anyone who has input
about formulas to relate output size to VidBR ...

Any insights/replied appreciated.
Thank you.
Regards,
AEN
Æ
 
     Top
phaeron
Posted: Dec 7 2008, 04:42 AM


Virtualdub Developer


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



Video compression works by taking advantage of and coding similarities within a frame and between frames. If you remove part of the video by cropping it, references to the parts that were removed have to be fixed. Because the dependencies are often chained with frames pulling from frames that pull from frames even farther back, this can be a complex task that is about as expensive as just re-encoding. It's possible to do a lossless crop with restrictions for simpler formats like JPEG, but for modern video compression formats, issues like accumulated error largely make this infeasible.
 
    Top
AEN007
Posted: Mar 8 2009, 02:06 PM


Advanced Member


Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08



8March2009
Greetings.
1) If one opens a video file with aviSynth in VDub and then saves
the file at the same video bitrate of the original input file,
is the output end result equivalent to being like
a lossless direct stream copy?
Eyeballing the output seems to indicate so,
but I wonder what the informed answer is.
2) I seem to have found a "tool" that someone else created
that allows one to actually use the VirtualDub direct stream copy
setting when saving a file opened with an avs script, so
maybe it is possible to do an avs/VD direct stream copy after all.
Any helpful replies/insights appreciated.
Thank you.
Regards,
AEN
Æ
 
     Top
stephanV
Posted: Mar 8 2009, 03:27 PM


Spam killer ;)


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



1) No. It's not lossless.

2) No, not possible. Filtering and Direct Stream *Copy* are mutually exclusive, by definition. You can use direct stream copy with an AVS script, but then you simply save an uncompressed file.

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
AEN007
Posted: Mar 8 2009, 04:14 PM


Advanced Member


Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08



8March2009
Greetings.
Thanks for the replies.

What about item #4?
(http://avisynth.org/mediawiki/FAQ_loading_clips#Has_AviSynth_a_direct_stream_copy_mode_like_VirtualDub.3F)
@
http://avisynth.org/mediawiki/FAQ_loading_clips

Today I tried the above for the first time.
I changed the name of the avisynth.dll in system32
to avisynthO.dll & tried the Dsynth avisynth.dll.
I loaded an avi file via an avs file in VD, cut the video down
to 7m10s, added an external wave file & saved the output
with DSC selected. The resulting file saved in less than a minute,
and the output file was 20,983,808 in size. I then changed the
Dsynth avisynth.dll file name to avisynthD.dll, changed
the avisynth 2.5.8.5 avisynthO.dll back to avisynth.dll,
closed & reopened VD & reran the exact same VD job.
The file saved in a few minutes, and the output file was
908,541,952 in size.

I don't know the science of PC video processing.
I wonder what is going on with this Dsynth avisynth.dll.
It does seem to "DSC" a file opened with avisynth.
The video bitrate of the Dsynth output file was stated
to be much lower than the vidbitrate of the input file, however.
I'll be doing some more trial & error with this new tool ...

Any helpful replies/insights appreciated.
Thank you.
Regards,
AEN
Æ
 
     Top
stephanV
Posted: Mar 8 2009, 04:18 PM


Spam killer ;)


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



Dsynth doesn't allow filtering, but only trimming and splicing. Things VirtualDub can do in DSC mode as well.

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
AEN007
Posted: Mar 10 2009, 05:30 PM


Advanced Member


Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08



10March2009
Greetings.
Thanks for the replies even though
they were not what I wanted to hear ...
I still hope that one day somehow
we could DSC files that have been cropped ...
aviSynth allows one to do some types of edits
and still use Fast Recompress that one could not
otherwise do if opening the file directly in VD, correct?

In any case I would like to confirm/clarify the following.
There is no point in using a bitrate higher than
the bitrate of the source file -
whether opened directly by VD or via aviSynth in VD, correct?

I have noticed that opening an mpeg/mpg (mp1/mp2) file
with aviSynth changes the duration of video & audio.
I have not (yet) noticed this with any other file type ...
I suppose "the powers that be" are aware of this?
This is unavoidable for some reason?

Any insights/replied appreciated.
Thank you.
Regards,
AEN
Æ
 
     Top
phaeron
Posted: Mar 11 2009, 03:03 AM


Virtualdub Developer


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



Sorry, but you won't be able to crop a video in direct stream copy mode in VirtualDub, Avisynth, or any other app. Doing so is simply intractable for all of the popular video compression algorithms, or at least, it can't be done in a way that would actually be better than just doing straight recompression. This is really only possible in very specific circumstances and with formats that are amenable to it, such as MJPEG.

As for using a higher bitrate than the source, the answer is actually yes, there can be a point. The reason is that you're not actually guaranteed that the encoder's heuristics will perform optimally when recompressing source, so you may actually need higher bitrate to maintain good quality. The better the encoder, the less of an issue this is.
 
    Top
AEN007
Posted: Jan 8 2010, 08:59 AM


Advanced Member


Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08



8January2010

Greetings.

What I described below is still happening when I use aviSynth input.
I can't leave the setting at Process all frames.
I have to set a frame rate value.

Any helpful insights/replied appreciated.
Thank you.
Regards,
AEN
Æ

QUOTE (AEN007 @ Dec 6 2008, 10:52 PM)
6Dec2008
I suppose the 160mb output result might be related to a new
problem I've encountered with VDub. I always set the frame rate
to "change so video & audio durations match".
(I always export/improve the original audio & then use my new
wave file as the source audio for the encoding.)
The problem I've encountered is that SOMETIMES when I leave
the frame rate conversion setting at "Process all frames",
the resulting avi output file is encoded incorrectly &
comes out super huge. Has anybody else encountered this issue?
I would of course like to hear from anyone
who knows more than me about this issue.
I don't know why this output encoding error occurs SOMETIMES
when I leave the frame rate conversion setting
at "Process all frames". If I then redo the encoding & set
the "Convert to fps" to 29.97 or 25.000 or whatever,
the resulting output is problem free.
 
     Top
AEN007
Posted: May 20 2010, 10:16 AM


Advanced Member


Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08



QUOTE (AEN007 @ Mar 10 2009, 05:30 PM)
10March2009
Greetings.
Thanks for the replies ...

I have noticed that opening an mpeg/mpg (mp1/mp2) file with aviSynth changes
the duration of video & audio. I have not (yet) noticed this with any other file type ...
I suppose "the powers that be" are aware of this?
This is unavoidable for some reason?

20May2010

Greetings.
After repeated frustration trying to achieve proper audio/video sync using aviSynth with mpg/mpeg files
in VirtualDub, I searched the web for solutions and found
CODE
For MPEG files you could use DirectShowSource ... But it would be better to use DGDecode for importing MPEG files
@
http://avisynth.org/mediawiki/First_script

Using DGDecode with aviSynth & mpg/mpeg files in VirtualDub
seems to have totally solved the a/v sync obstacle ...

Regards,
AEN
Æ
 
     Top
AEN007
Posted: May 23 2010, 03:23 PM


Advanced Member


Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08



23May2010

Greetings.
The DGDecode manual says,
QUOTE
LoadPlugin("[PATH\]DGDecode.dll")
Note: PATH can be ignored if DGDecode.dll is in the default AviSynth plug-in directory,
otherwise PATH must be specified.

I placed DGDecode.dll in the aviSynth plugins subdirectory
but still have to specify the path in my avs script.

Anyone know anything about this problem?

I put the Xlogo.dll in the aviSynth plugins subdirectory,
and can run avs scripts using Xlogo with no problems.

My previous question from 8Jan2010 still remains as well.

Any helpful insights/replied appreciated.
Thank you.
Regards,
AEN
Æ
 
     Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
15 replies since Nov 22 2008, 07:45 PM Track this topic | Email this topic | Print this topic
Pages: (2) [1] 2 
<< Back to Advanced Video Processing