VideoHelp Forum
+ Reply to Thread
Results 1 to 15 of 15
Thread
  1. Hi, I found a very old .AVI video on my HDD and I wanted to convert to an .MP4 video, but no player video seems to handle it.
    Searching deeper with GSpot Codec Information I found that the video needs the STVX Codec (ST CMOS Imager Data (Extended CODEC Data Format)). I suposed that the video was taken on a very old Motorola phone so i believe that the codec used for the video is too deprecated, so I was looking for the codec on the internet for several hours but everything was unsuccessful as the most official thing I found was on the fourcc.org website but without a download link.
    I tried to converted using several apps but I had no sucess.

    What do I have to do to be able to watch that damn video? I will attach the video here to see if any of you can view it or do me the great favor of converting it to a more current format.

    I'll be very grateful to you!

    Image
    [Attachment 45601 - Click to enlarge]
    Image Attached Files
    Quote Quote  
  2. IMHO this is raw video with raw audio - you can try tu export (unmux) from AVI video and audio as raw files. I think that codec may be part of driver (installed on system with camera driver), not sure about Linux, perhaps there is native support of ST sensors in Linux then you may try to use some tools from Linux world.

    I would try as first point to start search for drivers to STV0680 based webcam's - perhaps it will solve your issue.
    Quote Quote  
  3. Lone soldier Cauptain's Avatar
    Join Date
    Jan 2006
    Location
    Brazil
    Search Comp PM
    Its show on my PC:




    Claudio
    Image Attached Thumbnails Click image for larger version

Name:	SNAG-0610.jpg
Views:	172
Size:	213.1 KB
ID:	45604  

    Quote Quote  
  4. Yes, it appear to be some raw uncompressed form. Here's a 648x120 raw import of one frame as 8-bit greyscale data into an image editor. It looks like a 160x120 image, maybe interleaved lines of RGB? samples.
    Image Attached Thumbnails Click image for larger version

Name:	grey8.png
Views:	105
Size:	32.2 KB
ID:	45606  

    Quote Quote  
  5. Originally Posted by jagabo View Post
    Yes, it appear to be some raw uncompressed form. Here's a 648x120 raw import of one frame as 8-bit greyscale data into an image editor. It looks like a 160x120 image, maybe interleaved lines of RGB? samples.
    RGBG? RAW before debayer?
    Quote Quote  
  6. Cauptain must have the codec installed ? If you have it laying around somewhere maybe you can upload for the OP

    If you open the video in graphstudio, what does it say ? You can find more info on the .dll responsible for decoding by right clicking on the decoder box
    Quote Quote  
  7. Originally Posted by pandy View Post
    Originally Posted by jagabo View Post
    Yes, it appear to be some raw uncompressed form. Here's a 648x120 raw import of one frame as 8-bit greyscale data into an image editor. It looks like a 160x120 image, maybe interleaved lines of RGB? samples.
    RGBG? RAW before debayer?
    Or RGGB, since the two in the middle have about the same intensity. And that would make the frame 320x240.
    Quote Quote  
  8. Originally Posted by jagabo View Post
    Originally Posted by pandy View Post
    Originally Posted by jagabo View Post
    Yes, it appear to be some raw uncompressed form. Here's a 648x120 raw import of one frame as 8-bit greyscale data into an image editor. It looks like a 160x120 image, maybe interleaved lines of RGB? samples.
    RGBG? RAW before debayer?
    Or RGGB, since the two in the middle have about the same intensity. And that would make the frame 320x240.
    Perhaps, luckily there is limited number of combinations so checking should not be very difficult... some RAW dedicated software should be helpful, for example http://ufraw.sourceforge.net/
    Quote Quote  
  9. Assuming RGGB and using DebayerFilter in VirtualDub (the image was very dark so I mad gamma, brightness and gain adjustments too) I get this:

    Code:
    ImageSource("grey8.png") 
    
    # Assume RGGB
    R = Crop(0,0,162,120)
    G1 = Crop(162,0,162,120)
    G2 = Crop(324,0,162,120)
    B = CRop(486,0,162,120)
    
    # use Weave() to interleave R and G1 samples
    Interleave(R,G1)
    TurnRight()
    AssumeFieldBased()
    RG = Weave().TurnLeft()
    
    # use Weave() to interleave G2 and B samples
    Interleave(G2,B)
    TurnRight()
    AssumeFieldBased()
    GB = Weave().TurnLeft()
    
    # use Weave() to interleave GB and RG lines
    Interleave(GB,RG)
    AssumeFieldBased()
    Weave()
    
    Crop(0,0,-4,-0) # DeBayerFilter requires mod 16 width
    
    ConvertToYV12(matrix="PC.601") # DeBayerFilter() requires YV12 input
    
    DeBayerFilter(swap=0)
    FlipVertical()  # DeBayerFilter() outputs RGB, upside down
    
    RGBAdjust(rb=-18, gb=-18, bb=-18) # black level adjustment
    RGBAdjust(rg=2.2, gg=2.2, bg=2.2, r=2.0, g=2.0, b=2.0) # gamma 2.2, gain 2.0
    Image Attached Images  
    Quote Quote  
  10. I wrote a program to extract the STVX data from 2002.avi into an uncompressed RGB AVI video (rggb.avi). I then used a script similar to my earlier script to interleave the four side-by-side frames into a typical bayer pattern:

    Code:
    GRGR...
    BGBG...
    GRGR...
    BGBG...
    .
    .
    .
    and ran DebayerFilter() in AviSynth (debayered.avi). These raw videos are very dark so I brightened and cleaned them a bit to produce cleaned.mp4, which is a little more watchable. There were about 9 corrupt frames in the source -- or at least my simplified extraction resulted in corruption. Those corrupt frames were left in rggb.avi but removed from the other two videos.

    I'm having trouble uploading right now. I'll attach the files later...

    Files attached.
    Image Attached Files
    Quote Quote  
  11. You've left me speechless, it's great what you've accomplished with a file I thought was already dead.
    It would be great if you shared the scripts you've used because I'm sure I won't be the first or the last person to think that their "unreadable" AVIs were left without a solution.
    I will keep searching my hard drive to see if I can find another STVX type AVI that can be rescued.

    Thank you very much!
    Quote Quote  
  12. I misspoke a bit when I said I wrote a program to extract the STVX data to an uncompressed AVI. What I did was write a program to extract the STVX data to a raw file (containerless, no descriptive data, no metadata, etc.) Then use RawSource() in AviSynth to import that raw data, and VirtualDub to save it as an AVI file (VirtualDub added the container organization, descriptive data, etc.), and for the other processing. The script looked like:

    Code:
    import("C:\Program Files (x86)\AviSynth\plugins\TemporalDegrain.avs") 
    
    # fetch the raw video data as 8 bit greyscale samples
    RawSource("OUTPUT.RAW", 648, 120, "Y8", show=false) # get raw STVX video data
    AssumeFPS(15) # set the frame rate same as the AVI source
    
    ConvertToRGB(matrix="PC.601") # from full range Y8 to full range RGB
    
    # split the raw frames into four individual planes
    R = Crop(0,0,162,120)#.RGBAdjust(g=0,b=0) # the red plane
    G1 = Crop(162,0,162,120)#.RGBAdjust(r=0,b=0) # one green plane
    G2 = Crop(324,0,162,120)#.RGBAdjust(r=0,b=0) # the other green plane
    B = CRop(486,0,162,120)#.RGBAdjust(g=0,r=0) # the blue plane
    
    # interleave the red and green1 samples
    # ie, RRRRRR... GGGGGG...
    # to: GRGRGRGRGRGR...
    Interleave(R,G1)
    TurnRight()
    AssumeFieldBased()
    RG = Weave().TurnLeft()
    
    # interleave the green2 and blue sample
    Interleave(G2,B)
    TurnRight()
    AssumeFieldBased()
    GB = Weave().TurnLeft()
    
    # interleae the GB and RG samples
    Interleave(GB,RG)
    AssumeFieldBased()
    Weave()
    
    # The video is now in a proper bayer pattern for DeBayerFilter:
    
        ###########################
        #GRGR...
        #BGBG...
        #GRGR...
        #BGBG...      324x240
        #.
        #.
        #.
        ###########################
    
    # return(last) here if you want to use the bayered data in another program
    
    Crop(0,0,-4,-0) # DeBayerFilter requires mod 16 width
    ConvertToYV12(matrix="PC.601") # DeBayerFilter requires YV12
    
    DeBayerFilter(swap=0) # DeBayer the image
    FlipVertical() # it comes out upside down and RGB
    
    # return(last) here if you want the raw DeBayered data
    
    DeleteFrame(4, 18, 69, 106, 158, 164, 177, 199, 205) # delete corrupt frames, numbers detected manually
    
    # adjust black level, gamma, and brightness -- with a little white balance
    RGBAdjust(rb=-20, gb=-20, bb=-20)
    RGBAdjust(rg=2.2, gg=2.2, bg=2.2, r=1.5, g=2.0, b=2.8)
    
    ConvertToYV12()
    ColorYUV(cont_u=200, cont_v=200) # increase color saturation
    TemporalDegrain(SAD1=200, SAD2=150, sigma=8) # moderate denoise
    The program to extract STVC chunks as a raw dump:

    Code:
    #include "stdio.h"
    #include "stdlib.h"
    #include "string.h"
    
    unsigned char buf[25000000];
    
    
    // STVC chunks start with:
    // 0  0  d  b     length                     S  T  V  C 
    // 30 30 64 62   D0 38 01 00   FF FF 04 80   52 54 56 43   04 81 00 04
    
    
    int match_00db(unsigned char *buf)
    {
    	if (   (buf[0] == '0')
    		&& (buf[1] == '0')
    		&& (buf[2] == 'd')
    		&& (buf[3] == 'b')
    		&& (buf[12] == 'S')
    		&& (buf[13] == 'T')
    		&& (buf[14] == 'V')
    		&& (buf[15] == 'C'))
    	{
    		return(1);
    	}
    
    	return(0);
    }
    
    int main(int argc, char* argv[])
    {
    	FILE *infd;
    	FILE *outfd;
    	long len;
    	long i;
    
    	printf("Converting STVX AVI to RAW RGGB\n");
    
    	infd = fopen("INPUT.AVI", "rb");
    	if (infd == 0)
    	{
    		printf("Error opening INPUT.AVI for input\n", argv[1]);
    		exit(20);
    	}
    
    	outfd = fopen("OUTPUT.RAW", "wb");
    	if (outfd == 0)
    	{
    		fclose(infd);
    		printf("Error opening OUTPUT.RAW for output\n");	fclose(infd);
    		exit(20);
    	}
    
    	len = fread(buf, 1, sizeof(buf), infd);
    	for (i=0; i<len; i++)
    	{
    		if (match_00db(&buf[i]))
    		{
    			printf("found chunk at %ld\n", i);
    			fwrite(&buf[i+1032], 1, 77760, outfd); # 1032 bytes of "junk" (probably descriptive data) at the start of the chunk
    			i += (77760+1032);
    		}
    	}
    
    	fclose(infd);
    	fclose(outfd);
    
    	printf("Finished\n", argv[1], argv[2]);
    	
    	return 0;
    }
    Note this quick dirty program doesn't perform a proper parsing of the AVI file, it just loads the entire file into memory, blindly searches for what looks like STVC video chunks and dumps their payload out to a file. It has to be modified for files with different frame sizes, etc. And it will run out of memory if the files are too big. It was compiled with Pelles C as a 64 bit Windows console program.
    Quote Quote  
  13. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    @jagabo... I have to ask since i can't discern it after hours of perusing and parsing, where did you get the number 77760 as the length in your C program? I converted it to c++ but cant find where why you used that number. Just wanted to understand since I'm more visual basic minded than visual c.

    Thanks for r the program though. Great work as usual.
    Quote Quote  
  14. Originally Posted by Budman1 View Post
    where did you get the number 77760 as the length in your C program?
    The AVI headers says the video is 320x240 but when I initially experimented with importing the raw data into an image editor I found what appeared be four 162x120 images stacked horizontally. 162 * 120 * 4 = 77760. Also, as a sanity check, using VirtualDub's hex editor with it's RIFF chunk tree, you can see that the video chunks are 80080 bytes each -- so the image couldn't be more than that. Again, by experimentation I found there were 1032 bytes (including the RIFF header) of other data at the start or each chunk (at least one of the bad frames mentioned earlier had only 1028 bytes before the image data) that I had to skip over to get just the image data.
    Quote Quote  
  15. Member
    Join Date
    Dec 2018
    Location
    Bulgaria
    Search PM
    I was looking for a STVX codec myself to watch some videos from an old Polaroid camera I had until I remembered I have a disk with drivers for that camera.
    So, here's the setup file that installs the driver for the STVX codec. It works on WinXP. I haven't tried it on any other version of Windows. I hope it's useful.
    Image Attached Files
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!