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 > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th November 2002, 12:35   #161  |  Link
wanton
Registered User
 
Join Date: Jan 2002
Posts: 28
I just want to end this stupid YV12 mpeg2dec.dll thing because it's not possible to do. Only format that would work would be frame encoded mpeg2 file like svcds if you use force film option. Because most atleast anime dvd's have field/frame encoded frames meaning chroma is halved in field and frame mode diffrently in field mode it's halved field based and in frame frame based. and YV12 in avisynth is frame based. Then another problem is pulldown if you do normal output from mpeg2dec from material with pulldown added with flags mpeg2dec makes virtual frames using flags so if you do it in YV12 you would get quality loss because you would have to blend chroma and it would look shitty. Same thing with IVTC when you combine frame by field basis YV12 is shitty format. So only format YV12 would be any good for would be progressive frame based encodes without pulldown. Even progressive looking material could have been encoded in field format Looks progressive but have been encoded with field based.
wanton is offline   Reply With Quote
Old 9th November 2002, 14:40   #162  |  Link
Koepi
Moderator
 
Koepi's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 4,454
wanton:

you might want to do some background checks before posting such an misleading, wrong crap. Sorry pal, but the info you're "relying" on is wrong.

If your assumptions were right then mpeg2 couldn't be YV12 colour space internally - but it is.

Now please do some research, let us non-anime encoders our progressive YV12 fun and stop rumbling around. Read the forum rules, you sure broke no. 4.

*scratching head*

Koepi
Koepi is offline   Reply With Quote
Old 9th November 2002, 19:29   #163  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
wanton -

Be aware that Avisynth already maintains flags for each clip saying whether it is frame-based or field based. And it is mostly only the deinterlace, IVTC, and conversion functions that will care.

It is true that Avisynth considers the entire clip to be either one or the other but if that becomes a problem for mixed clips we can pass along additional flags from any YV12 supporting versions of MPEG2DECx. Frankly I would like to have them anyway because of the guidance they could provide to IVTC type functions.

You might also consider that it is the job of a deinterlace or IVTC function to convert a clip to all progressive frames. Since these functions should invariably be run first before other filters you can figure that most Avisynth functions can then be operating on frame based material. And as I mentioned above (I think this thread) those IVTC/deinterlaced functions should be sure to always set the AssumeFrameBased flag for clips they process.

We've probably glossed over other details also but nothing that I do not believe is solvable. And I still believe that handling things in their native YV12 format will give both faster and more precise results. For instance I think there can be much greater chroma precision if deinterlace/IVTC is done before any YUY2 color conversion since frame based clips can be created. And we've already seen that many operations may be written to be faster.

So sure there are issues to be dealt with but with much of our input material now coming from MPEG2/YV12 in the form of DVD's, Tivo's, and (increasingly) HDTV it would be silly not to explore this.

I think at worst it will turn out that some clips can not be processed optimally using both YV12 and DirectShowSource, but I don't consider DirectShowSource all that reliable anyway. But I'm pretty confident that at least the DVD2AVIx/MPEG2DECx YV12 path can be made quite functional and eventually better for many purposes than either YUY2 or RGB.

- Tom

Last edited by trbarry; 9th November 2002 at 19:48.
trbarry is offline   Reply With Quote
Old 9th November 2002, 20:38   #164  |  Link
scmccarthy
Registered User
 
Join Date: Oct 2002
Posts: 462
WOW Tom, that makes a lot of sense.

I think it is intuitively obvious that if we want to reencode mpeg-2 into mpeg-4, becuase it compresses better, since they both use the same color space it is better to stay in that color space because color space conversions are lossy. You also point out that some filters are actually easier to write in YV12 than YUY2. And I think that filter writers who have already made the transition from RGB to YUY2 will have no problem learning YV12 provided the benefits are worth it and they are. Meanwhile it is important to have the best conversion filters possible so filter writers can write in the color space of their choice with minimal impact on quality.

I am trying to write a filter in c++ using just cl.exe and link.exe that converts from YV12 to YUY2 by resizing the luma rather than interpolating the chroma. I'll post the code in a new thread later, but meanwhile, since you mentioned flags, I wonder if you know whether Avisynth 2.5 has some flag or structure member that needs to be set saying color space is now YUY2 instead of YV12? Or to change the size, since the vertical resolution gets reduced by a factor of 2?

The new YV12 Invert and my code compiled properly, so my primative development environment does work. Don't accuse me of going off topic, this question is about Avisynth 2.5 flags and structures as it relates to YV12. I'll ask about my code in a new thread.
scmccarthy is offline   Reply With Quote
Old 9th November 2002, 23:04   #165  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
Hi ^^

i'm dead. i've coded 5 hours to get MPEG2Dec3 v0.9 ready (but not clean enough code-wise )
and i've spend 2 hours on the documentation, because my filter always lack of it, and i hope my efforts would be appreciated.

i'm gonna open a new thread for MPEG2Dec3 v0.9 it's avisynth 2.5 ONLY compatible, able ouput native YV12, and to convert to YUY2/RGB24 (interlaced or progressive) , to Separate YV12 Fields (only topfirst yet), and some other stuff.

@tom

i'll give you the code ASAP. but i think it couldn't today : i really need to sleep ^^.
Marc FD is offline   Reply With Quote
Old 11th November 2002, 10:17   #166  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
@tbarry,

If you are going to modify mpeg2dec3 you modify it (and dvd2avi) such that the AC3 stream is passed through (if it is present of course, since there's no mp2 support yet).
Wilbert is offline   Reply With Quote
Old 11th November 2002, 13:53   #167  |  Link
int 21h
Still Laughing
 
int 21h's Avatar
 
Join Date: Oct 2001
Location: Around
Posts: 1,312
Quote:
Originally posted by Wilbert
@tbarry,

If you are going to modify mpeg2dec3 you modify it (and dvd2avi) such that the AC3 stream is passed through (if it is present of course, since there's no mp2 support yet).
I thought AVISynth had no compressed audio support yet anyways?
int 21h is offline   Reply With Quote
Old 11th November 2002, 13:55   #168  |  Link
hakko504
Remember Rule One
 
hakko504's Avatar
 
Join Date: Oct 2001
Location: SWEDEN
Posts: 1,611
Compressed audio support was introduced in v2.04. List of changes and latest CVS release
is here
__________________
/hakko

http://www.boardgamegeek.com
hakko504 is offline   Reply With Quote
Old 11th November 2002, 13:58   #169  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
I thought AVISynth had no compressed audio support yet anyways?
You need to be more around on this forum! Since v2.04 there is compressed audio support (DivX/Xvid with mp3 audio VBR/CBR).

In v2.5 there is multichannel support (DivX/Xvid with AC3 audio VBR/CBR).

and there are more plans ...
Wilbert is offline   Reply With Quote
Old 11th November 2002, 14:11   #170  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
AviSynth doesn't have INTERNAL compressed sound, and probably will never have - I think this is what int 21h is talking about.

All audio still needs to be decompressed, just as images have to.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 11th November 2002, 15:17   #171  |  Link
int 21h
Still Laughing
 
int 21h's Avatar
 
Join Date: Oct 2001
Location: Around
Posts: 1,312
Quote:
Originally posted by Wilbert
You need to be more around on this forum! Since v2.04 there is compressed audio support (DivX/Xvid with mp3 audio VBR/CBR).

In v2.5 there is multichannel support (DivX/Xvid with AC3 audio VBR/CBR).

and there are more plans ...
I get around quite enough thank you.

And as sh0dan confirms, I meant passing through audio similar to WavSource() functionality. Instead of crutching mpeg2dec to pass AC3, work should be done on an AC3Source() filter, or maybe a general AudioSource() filter.
int 21h is offline   Reply With Quote
Old 11th November 2002, 15:56   #172  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
Quote:
Originally posted by int 21h
Instead of crutching mpeg2dec to pass AC3, work should be done on an AC3Source() filter, or maybe a general AudioSource() filter.
The most obvious way (IMO) would be for someone to create a link to besweet.dll. It offers decoding of all important standards.
A besweet input/output plugin would be VERY helpful for all cases, and should be much easier with the 2.5 API.
I would love to help anyone up to the task, if they get problems with the AviSynth part.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 11th November 2002, 16:40   #173  |  Link
int 21h
Still Laughing
 
int 21h's Avatar
 
Join Date: Oct 2001
Location: Around
Posts: 1,312
a BeSweet I/O plugin would more or less be something like..

BeSweet("audiosource.wav/ac3/etc",500 parameters here)

or are you talking about trying to encode the stream of an input given, like the soundtrack of an avi file or MPEG file. In its current incarnation, its impossible to use BeSweet.dll as a simple decoding tool because it always outputs its encoded result into a file (so you couldn't just pass a sample of PCM to it and get back a sample of MP3 and pass that through Avisynth to the destination environment)

It seems like it would be so much more useful to have the functionality inside of Avisynth so that you could compress/process outside of Avisynth, and the support of the input of compressed audio but lack of support for the output of compressed audio seems ..
int 21h is offline   Reply With Quote
Old 11th November 2002, 17:18   #174  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
OK, let's just start all over then - this is why I would like something like besweet:

I would very much like for people to be able to do advanced editing, even if their source is from a DVD. That also means that audio has to be put alongside video. For example:
Code:
Mpeg2dec2("poelle.d2v")
audiodub(AudioSource("poelle.ac3"))
trim(505,-10000)
l_ch = getchannel(1)
r_ch = getchannel(2)
mergechannels(l_ch,r_ch).normalize().ssrc(rate=44100)
So the user gets out two-channel, completely in-sync audio. As MP3 or just WAV for starters.

What would be the best solution in your opinion?

I'd really wish I has the time to get in some great audio functionality, like ssrc, SuperEQ, Boost (sound compression). But I cannot do the code for it until 2.5 is out.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 11th November 2002, 17:37   #175  |  Link
Nic
Moderator
 
Join Date: Oct 2001
Location: England
Posts: 3,285
I started it & then got completely sidetracked. At present, as far as I know, besweet.dll doesn't let you have access to the output frames (i.e. it gets you to specify an output file then you use *_Burst to send the input packets).

That would need to be changed before a besweet plugin can be made....

-Nic
Nic is offline   Reply With Quote
Old 11th November 2002, 17:41   #176  |  Link
int 21h
Still Laughing
 
int 21h's Avatar
 
Join Date: Oct 2001
Location: Around
Posts: 1,312
Quote:
Originally posted by sh0dan
OK, let's just start all over then - this is why I would like something like besweet:

I would very much like for people to be able to do advanced editing, even if their source is from a DVD. That also means that audio has to be put alongside video. For example:
Code:
Mpeg2dec2("poelle.d2v")
audiodub(AudioSource("poelle.ac3"))
trim(505,-10000)
l_ch = getchannel(1)
r_ch = getchannel(2)
mergechannels(l_ch,r_ch).normalize().ssrc(rate=44100)
So the user gets out two-channel, completely in-sync audio. As MP3 or just WAV for starters.

What would be the best solution in your opinion?

I'd really wish I has the time to get in some great audio functionality, like ssrc, SuperEQ, Boost (sound compression). But I cannot do the code for it until 2.5 is out.
I am of the same general opinion, except I believe the output format and encoding process should be left up to the user. Decoding AC3 to Wav is a good idea, but in my mind encoding to mp3 just seems like a bad idea, also offering the pass through of AC3 would be convenient.

In my mind, Avisynth is an editing framework, and as such it should not be reliant on any specific encoding technologies because of the pace at which those technlogies evolve. (Consider 2 years ago what we encoded MP3s with)

All of this really became relevant to me when I started helping out with AVS2AVI because only having a WavSource() input filter for audio severely limits any program that relies on the Avisynth interface. In my mind AudioSource would have arguments, allowing you turn decoding on/off, and AudioSource ideally would not be reliant on third-party .dlls (using internal decoding like AC3Dec, which could probably use some work), however, you could use the straight azid.dll because its calls work as follows:
Code:
//
// Decode one frame of ac3
//
// Decode the ac3-frame in 'ac3data' into pcm samples in 'pcm'. The output
// samples are interleaved according to the setting 'speaker_sequence'.
// E.g for stereo the first sample (pcm[0]) is left channel, sample 0, and
// the second (pcm[1]) is sample 0, right channel, etc. The float value
// range of the pcm samples are -1.0 to 1.0.
//
// Returns: The result of the operation. Use the following macroes to check
//          if the operation is successful or not:
//          AC3_OK()              The operation was successful
//          AC3_FAILED()          Some serious error has occurred and the
//                                decoder program  should quit.
//          AC3_PRODUCEDOUTPUT()  The decoder has produced data, i.e. the
//                                data in 'pcm' is updated and contains
//                                valid data.
//
int ac3_decode(u32 *ac3data,f32 *pcm);
and you could still deliver a single sample of pcm for the final encoding application.
int 21h is offline   Reply With Quote
Old 11th November 2002, 18:04   #177  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
IMO all import/export of compressed audio formats should never be an internal AviSynth functionality - just as MPEG2 decoding also shouldn't be.

All of my suggestions were for plugins. I don't think any of these belong inside AviSynth, but they should be separate plugins. Therefore depending on external dll's is not that big a problem, IMO.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 11th November 2002, 18:13   #178  |  Link
int 21h
Still Laughing
 
int 21h's Avatar
 
Join Date: Oct 2001
Location: Around
Posts: 1,312
I admit that makes more sense, I'm not familiar enough with Avisynth framework to know how to make a plugin like AC3Source(), but maybe if I get some time I'll look... it can't be all that different from the principles in Mpeg2dec except that you're working with audio.
int 21h is offline   Reply With Quote
Old 11th November 2002, 18:42   #179  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
Basicly, the only difference is that you extend GetAudio instead of GetFrame.

You can see how to handle audio in audio.cpp/audio.h in the AviSynth sources - it's really easy, if you have worked with samples before.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 11th November 2002, 20:55   #180  |  Link
int 21h
Still Laughing
 
int 21h's Avatar
 
Join Date: Oct 2001
Location: Around
Posts: 1,312
I'm somewhat confused on how you need to offer seeking capabilities. I'm expected to provide a GetAudio(void* buf, __int64 start, __int64 count, IScriptEnvironment* env), Azid only provides a function to read 1 frame into memory, and it appears to be sequential access only (i.e. I can't specify what frame or sample I'd like to retrieve, but if I built my own reading function I suppose I could supply it the frame to decode via the Decoding function), even if I do supply my own reading function, there will still be times that you have to loop forward to seek in the file right?
int 21h 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 05:41.


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