View Full Version : YUV-Bitmap Import filter?
billou2k
24th May 2004, 13:28
Really? That would be great!
Thanks a lot for your time!
WarpEnterprises
26th May 2004, 08:58
please try
http://www.avisynth.org/warpenterprises/files/rawsource_25_dll_20040525.zip
hope it works now.
billou2k
26th May 2004, 13:29
Indeed it works perfecly well! great job!
Thanks a lot for fixing it so quickly!
billou2k
18th June 2004, 14:40
Warp: Sorry to bother you again but I discovered some problems using rawsource.
I'm using avisynth also to do some overlay on the raw YUV sequences I'm reading with "rawsource".
Unfortunately it's crashing after 20 seconds of processing, with the PC getting very very slow (dual 3GHz 2GB of ram).
After some more testing I realised that MPC or VDUB playing (or saving to avi) the avs file containing only rawsource use more and more memory during the playback: it goes up to 1.4 GB after 24 seconds of PAL raw YV12...
Playing the same video wrapped in an avi file yv12 (rather than the raw yv12 file using rawsource) just uses 20MB or so at the maximum.
So It looks like the rawsource plugin keeps in memory all the pictures it has decoded rather than just keeping the current one. Does it make sense?
Do you think that this is something that could be solved, so that I could run my main script?
Thanks a lot for your plugin.
Cheers
WarpEnterprises
21st June 2004, 11:28
did you try to NOT put it in the plugin dir as Wilbert suggested?
do you use the latest AviSynth version?
I can't find any obvious memory allocation error - the plugin isn't allocating memory at all.
billou2k
21st June 2004, 11:48
Actually I never put rawsource in the plugin dir, I'm just loading it from the current directory.
I'm using the latest avisynth as well (v2.55, 17 june 2004)
Ok... I would have thought the problem might come from rawsource but maybe it comes from avisynth then....
Can anybody else observe the memory used by Avisynth/Vdub/MPC increase to non sensible heights ? (1.4 GB after 24 seconds of PAL video)
I dont know what to do now:D I can try on another computer though and check if it does the same thing or not...
WarpEnterprises
22nd June 2004, 08:13
I checked again. I see this:
AviSynth eats up RAM according to its cache strategy, e.g. up to 100MB on my 256MB system.
Maybe there is an error how it measures free ram.
@billou2k:
1) which OS?
2) please try SetMemoryMax(100) and look if it obeys the 100MB barrier.
billou2k
22nd June 2004, 19:22
Thanks for your reply,
I'm running XP but I tried on a 2K system with 1GB of ram and it eats most of the remaining memory also (600MB or so)
I havent had much time yet, but after some quick tests it looks like adding the SetMemoryMax(100) helps a bit but doesnt respect the 100MB barrier although it is much better than before (600MB instead of 1400MB for 24 seconds of raw PAL YV12)
But that strange behaviour of eating more and more memory as the video plays seems strange to me...
Anyway thanks for the help!
Wilbert
5th April 2005, 21:58
@WarpEnterprises,
Is it possible to add YUV4MPEG support to your plugin? As I understand it YUV4MPEG is just "header + raw planar YUV".
WarpEnterprises
6th April 2005, 14:59
Can you point me to a source test clip and/or discussions?
If it's possible to parse or recognise the header it should be not that hard.
ac-chan123
6th April 2005, 20:46
If i'm right, then this was something that mjpegtools createt and is now used by all Video Tools under Linux(ffmpeg, mplayer, transcode, ...)
Some c code can be found at http://parallel.vub.ac.be/~johan/MpegStills/ .
Wilbert
6th April 2005, 21:33
avs2yuv also creates it (it creates planar I420)
http://students.washington.edu/lorenm/src/avisynth/avs2yuv/
akupenguin wrote it. So i'm sure he can help if necessary :)
This is newer c code:
http://cvs.sourceforge.net/viewcvs.py/mjpeg/mjpeg_play/utils/#dirlist
Apperently more colorformats are supported, but simply I420 would be sufficient for now.
WarpEnterprises
7th April 2005, 08:20
1) Good news: if you use avs2yuv with -raw and then RawSource(filename, width, height, "YV12") it works already. When using "I420" U/V are permuted - I'm sorry I confused I420 and YV12.
2) Using the native format will be a little more work, as the frame positions are theoretically not equally spaced (the FRAME header can be different). But if I assume that there is no data in the frame header it makes it much easier. This will be always the case if the stream is not "interlaced mixed" - which AviSynth can't handle AND if there are no "metadata" of variable length.
Wilbert
7th April 2005, 09:30
1) Good news: if you use avs2yuv with -raw and then RawSource(filename, width, height, "YV12") it works already.
I know. Fred asked me about it and he's using TyTool (which outputs YUV4MPEG). So, that's why i asked you. I asked Fred to send a sample stream to me.
When using "I420" U/V are permuted - I'm sorry I confused I420 and YV12.
Are you sure? It's not the case that avs2yuv accidentely outputs YV12? I'm at work, can't check it now.
2) Using the native format will be a little more work, as the frame positions are theoretically not equally spaced (the FRAME header can be different). But if I assume that there is no data in the frame header it makes it much easier. This will be always the case if the stream is not "interlaced mixed" - which AviSynth can't handle AND if there are no
"metadata" of variable length.
I asked Fred to check/ask what kind of YUV4MPEG stuff TyTool outputs. I will let you know if he responds.
btw, what kind of data is "metadata" of variable length?
WarpEnterprises
7th April 2005, 11:15
I attach the specs for the header, there is not mentioned, what exactly the metadata should be used for. Maybe something like DG's hints?
FredThompson
9th April 2005, 05:26
Originally posted by Wilbert
I know. Fred asked me about it and he's using TyTool (which outputs YUV4MPEG). So, that's why i asked you. I asked Fred to send a sample stream to me.
..
I asked Fred to check/ask what kind of YUV4MPEG stuff TyTool outputs. I will let you know if he responds.TyTool's author is now active here as "jdiner". There's some chatting between him and nic over in the MPEG2 encoders area. He's a better source than me for the samples you want. I can grab them as TyTool processes but it's quite awkward.
jdiner
11th April 2005, 06:47
I would be happy to provide some source metrics. I also sent out a PM with the details of what TyTool is doing with it.
I am new to this forum and uncertain what the rules are here for posting, size-wise etc... Until I can get caught up on such then please feel free to make requests and I will fill them as fast as I can.
EDIT: I suppose I should add that I can provide the C++ source I use to make the files, although it is small enough not to be of that much use, and if I can find it the C++ source I wrote to load the files as well. (haven't seen it in a while but a grep search should turn it up if anyone wants to see it.)
--jdiner
WarpEnterprises
12th April 2005, 14:23
check this if it's doing what you thought of:
http://www.avisynth.org/warpenterprises/files/rawsource_25_dll_20050412.zip
FredThompson
12th April 2005, 14:35
Heh, you just might be my hero!
Not, like, in that way...harumph...how bout that football team, yeah!
Wilbert
12th April 2005, 16:08
So, it works for you?
Btw, could you upload a YUV4MPEG sample?
jdiner
14th April 2005, 07:05
Originally posted by Wilbert
So, it works for you?
Btw, could you upload a YUV4MPEG sample?
I have not tested it. Hopefully FredThompson has been able to do so.
Here is a sample y4m file, YUV4MPEG, as requested. It has been packed up as a zip file.
--jdiner
jdiner
14th April 2005, 07:06
Humm. I am used to attachments showing up immediately in other forums. I assume it didn't here because there is some kind of moderator oversight.
Anyway it has been posted, hopefully it will appear here soon.
--jdiner
WarpEnterprises
14th April 2005, 08:02
There were two bugs in the rawsource-DLL. Please try the new version.
(rawsource_25_dll_20050414.zip)
billou2k
14th April 2005, 13:34
Hi thanks WarpEnt for still improving rawsource I think that is a very useful filter indeed!
I've just tried the latest version (20050414) and it looks like when importing raw YV12 the U and V channels are swapped. (swapUV() function fixes the colour problem)
I tried again the same clip with the 2004.05. version and colours are fine.
Could there be some code from the YV12 mode changed by adding the support for YUV4MPEG?
Cheers
Wilbert
14th April 2005, 21:38
@jdiner,
If your sample consists out of one frame (?), then it loads fine :)
jdiner
15th April 2005, 06:46
Originally posted by Wilbert
@jdiner,
If your sample consists out of one frame (?), then it loads fine :)
No. It had several frames in it. 4 I think.
I will have to download what was uploaded and make sure. I will post my results.
EDIT: My appologies. I remember now having to cut it down to get it small enough to post here. There are 2 frames in there.
HEADER FRAME (data) FRAME (data) [EOF]
I can make one of larger sized file with 10 or more frames in it if someone can host it. I will see if I can get my old BSD box un-mothballed. Until that happens anyone want to host a 4 or 5 meg ZIP file?
--jdiner
FredThompson
15th April 2005, 07:26
Cut it into chunks (WinRAR, HJ-Split, etc.) and email it to me. I'll host it and any other samples you want posted.
WarpEnterprises
17th April 2005, 21:49
@billou2k: in the latest version U/V is intentionally swapped since I think it was wrong before. You can use "I420" or "YV12" as format strings, one of them will do it (no need to SwapUV, which of course will work too).
FredThompson
19th April 2005, 01:39
Here's a 29-frame YUV4MPEG sample from jdiner
http://home.mindspring.com/~utils/29frames.rar
WarpEnterprises
19th April 2005, 09:19
29frames.y4m works for me.
ac-chan123
19th April 2005, 14:39
here is an alternate source:
http://www1.mplayerhq.hu/MPlayer/samples/yuv4mpeg2/
Wilbert
20th April 2005, 20:59
29frames.y4m works for me.
If I open the clip it has 28 frames, not 29? (The other had one frame instead of two, perhaps a frame is dropped somewhere ?)
jdiner
25th April 2005, 05:04
Originally posted by Wilbert
If I open the clip it has 28 frames, not 29? (The other had one frame instead of two, perhaps a frame is dropped somewhere ?)
It has 29 frames. I just verified that.
Open it up in a hex editor or your favorite tool for doing such viewing and search for the ASCII string "FRAME".
Everything before the first one is the header, the first occurance marks the transition from the file header into the first frame. Each occurance of frame after that marks the transition to the next frame.
In viewing it in that way it is clear that there are 29 frames. In running it through the currently used compressor it results in 29 output frames.
Would appear that there is still an issues in the current loader code.
--jdiner
WarpEnterprises
25th April 2005, 20:31
Yes, yes, yes, my fault.
http://www.avisynth.org/warpenterprises/files/rawsource_25_dll_20050425.zip
Wilbert
25th April 2005, 21:37
Thumbs up!
jdiner
25th April 2005, 22:39
Originally posted by WarpEnterprises
Yes, yes, yes, my fault.
No insult intended. Just trying to be helpful. :)
--jdiner
Mug Funky
28th August 2005, 08:23
thread resurrection!
i'm playing with rawsource to load uncompressed mov. it's working pretty well on raw video files i've demuxed using mplayer (which couldn't play it, and wasn't very helpful in transmuxing to avi), but the frame headers mean the picture moves by 2 pixels per frame. chroma stays aligned, thankfully.
is it possible to mod rawsource to allow an arbitrary (constant...) header size to be input? or even a header string in hex? (it's "c0ad0a00"). that would be totally awesome, as it's totally stupid that it's so hard to get uncompressed UYVY out of quicktime and put it in avi without converting to RGB first...
rawsource is the closest i've come to getting these files converted (audio is handled fine by mplayer, so it's not a problem), and it's FAST, which is a good thing indeed :)
WarpEnterprises
12th September 2005, 07:07
Can you send me a small sample? (~ 5 frames) I don't understand exactly what you mean.
WarpEnterprises
21st September 2005, 16:02
Try this (you can enter a constant header offset):
http://www.avisynth.org/warpenterprises/files/rawsource_25_dll_20050921.zip
I got a sample with an offset of 1024. The width of the video was 720, but it had strange 304 lines and is interlaced, so you have to use:
RawSource("c:\_video\test2.2vuy",720,304,"UYVY", offset=4*256)
AssumeFieldBased
Weave
I guess the 16 more lines are control data or such, you can simply crop it away.
Tell me if it works for you!
peter100m
22nd September 2005, 10:25
@WarpEnterprises: Thank you for your work! The sample I sent you was indeed interlaced and had a height of 608. The extra lines (608-576) contains the visible vitc-code (and I guess other control data.) The constant header offset works and I've tested this so far with sources from 2 different editing systems.
@Mug Funky: There is no longer any need to go over ffmpeg or mplayer to demux the uncompressed Quicktime files to get the YUV-data. Open the .movs with the new version of Rawsource. One not though: the Quicktime files can not contain any audio or there will be garbage pixels visible (the audio data).
Wilbert
23rd September 2005, 15:55
Just curious. What's vitc-code?
@Mug Funky,
Could you upload 2-3 frames raw mov somewhere? I'd like to have it.
ac-chan123
24th September 2005, 04:56
http://www.google.com/search?q=vitc
peter100m
26th September 2005, 13:41
about VITC: http://en.wikipedia.org/wiki/Vertical_interval_timecode
An image of what the VITC looks like here (http://www.ptr.se/video_stuff/vitc_displayed.jpg) . The white rectangles are bits of information visible in the picture. Note that this image includes the overscan area (which is why we see the VITC).
@Wilbert
I've uploaded two samples that works with the new Rawsource.
The first one is here (http://www.ptr.se/video_stuff/blue_yuv_720x608.rar) (2mb)
RawSource("x:\blue_yuv_720x608.2vuy",720,304, "UYVY",offset=4*256)
AssumeFieldBased()
ComplementParity()
Weave()
AssumeFPS(25)
And the other one (2mb) (http://www.ptr.se/video_stuff/uncompressed_yuv_no_audio_720x486.rar) is an uncompressed Quicktime movie.
RawSource("x:\uncompressed_yuv_no_audio_720x486.mov", 720, 486,"UYVY", offset=48)
edit: url typo
WarpEnterprises
7th October 2005, 13:51
I made a new version of RawSource which can use an index string (or index file).
You can specify the position of the first frame, a fixed interval, two interleaved intervals or only some arbitrary key frames.
http://www.avisynth.org/warpenterprises/index.html#rawsource
To find the intervals a little command line tool is included. It "may" work on YUV files (not with RGB) - it seaches for big blocks of valid YUV data.
peter100m
8th October 2005, 12:43
Nice work WarpEnterprises!
This is really useful! The Yuvscan tool as well!
One issue though: RawSource can't parse the default index file from yuvscan. There's an extra line in the beginning of the file and white spaces on every line. If I remove those it works.
Will try more uncompressed Quicktime sources soon, but so far so good! :)
shorton
11th October 2005, 15:29
Warpenterprises:
Wilbert's been helping me with a project where I'm now trying to import a particular raw YUV format to avoid any color conversions. Thread HERE (http://forum.doom9.org/showthread.php?p=722042#post722042). The author of the format I'm trying to use (drmpeg) says its a:
>> 720x480 4:2:2 YCbCr file in headerless planar format (720*480 bytes of
Y, followed by 360*480 bytes of Cb and then 360*480 bytes of Cr). <<
A sample file is here:
http://www.w6rz.net/ycsd.yuv
It is my understanding these are single frame files.
I need to get Rawsource to read that format if possible. Wilbert may already be working on it (thanks Wilbert!), but I thought I'd mention it here since it's specific to rawsource and Wilbert may not have time to fiddle with it right now.
Any help getting this format to be read properly by Avisynth would be most appreciated.
Presuming Rawsource becomes able to read that format, I've still got to turn those single frames into multiple frames at 59.97fps like Imagesource, but that's a different thing to figure out :)
Thanks guys! Best, Scott
WarpEnterprises
11th October 2005, 20:01
Doesn't give one of
RawSource("d:\avitest\ycsd.yuv",720,480,"I420")
RawSource("d:\avitest\ycsd.yuv",720,480,"YV12")
the correct result? It seems Ok, but the example is too meaningless to tell.
Wilbert
11th October 2005, 20:07
@WarpEnterprises
That sample file is 4:2:2 planar (not 4:2:0).
shorton
11th October 2005, 23:13
Doesn't give one of
RawSource("d:\avitest\ycsd.yuv",720,480,"I420")
RawSource("d:\avitest\ycsd.yuv",720,480,"YV12")
the correct result? It seems Ok, but the example is too meaningless to tell.
Thank you for the help:
I had been trying to open the files directly in the encoders. Both promptly crash either encoder. So per Wilberts suggestion I opened them in Virtualdub. They do open but they are not right. And either image crashes virtualdub on closing.
The image is supposed to look like the attached reduced jpeg:
Wilbert
11th October 2005, 23:28
@WarpEnterprises,
I modified rawsource.cpp a bit. It can open raw YV16 (planar 4:2:2) now and converts it to YUY2.
But it still has the problem that VDub/VDubMod crashes upon exit (removing rawsource.dll outside the plugin folder didn't help).
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.