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. |
20th March 2005, 14:59 | #1 | Link | |
Guest
Posts: n/a
|
How to read fourcc in avi and use it in avisource?
I wonder if there ia a way to read the fourcc(codec)in avi file, before opening it with avisource - in order to open the avi with the proper codec?
I want to get avisynth to do this automaticly so any avi can be opened with the right codec if it is installed. On reading the fourcc's I found this: Quote:
Has anyone found a solution to this? Tin2tin |
|
20th March 2005, 15:41 | #2 | Link | |
ffdshow/AviSynth wrangler
Join Date: Feb 2003
Location: Austria
Posts: 2,441
|
Re: How to read fourcc in avi and use it in avisource?
Quote:
If the FourCC is bogus, or you want to use a different codec, use a different FourCC by adding a FourCC="...." parameter to your AVISource call... Isn't this what you're looking for? np: Markus Guentner - Regensburg 1 (Regensburg) |
|
20th March 2005, 21:49 | #4 | Link | |
Guest
Posts: n/a
|
Quote:
Last edited by Maximillius; 20th March 2005 at 21:56. |
|
20th March 2005, 23:03 | #5 | Link |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,227
|
And if you want to change your Mpeg4 .AVI's 4CC code, you can always use "Nic's FourCC changer": -
Cheers
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
|
20th March 2005, 23:23 | #6 | Link |
Guest
Posts: n/a
|
The reason for my question is that I'm trying to figure out an error free way to load any avi file into avisynth from my DVD slideshow GUI - or at least find a way to throw a warning/avoid loading/suggest a codec - if the user is loading an avi with an unsupported/uninstalled codec.
Thanks for your replys, Tin2tin |
23rd March 2005, 17:01 | #7 | Link |
Registered User
Join Date: Mar 2005
Posts: 65
|
Actually, I'd love to have access to the FourCC of an AVI within avisynth itself, to help with the NLE I'm trying to build on it. There may be some CLI program that can spit back a FourCC, but I'd like to keep as much of the loading process within Avisynth itself as possible.
When I first load a file, I'm using WriteFileStart to create a text file with the clip's original properties (height, framecount, colorspace, etc). Having access to the FourCC so that I could write it out in the same place would be quite helpful. I was able to make a function to spit out colorspace (using the various isRGB24, etc), but I don't think there's any current way to get the FourCC. So, would someone be able to hack together a variation on AVISource that just returns the FourCC as a string instead of returning the actual clip? That'd be great for my own uses (and Tin2tin's) and could also help automation in other people's scripts. Like if you know the file is DV, you can assume that it needs to be de-interlaced and take that into account. Many thanks, Shawn |
23rd March 2005, 21:10 | #8 | Link |
Guest
Posts: n/a
|
I got some help on solving this on the wxbasic forum.
I guess that this solution could be ported to a c function, since there is no readfile(txt) in avisynth yet(as far as I know). But I'm not into c. Tin2tin Last edited by Guest; 24th March 2005 at 01:49. |
24th March 2005, 05:24 | #9 | Link |
Registered User
Join Date: Mar 2005
Posts: 65
|
Hmmm, now that you mention it, I should be able to grab the FourCC using Python's various file-reading commands. I still think it'd be more elegant to be able to grab it from within Avisynth, though. Maybe I'll try tackling an avisynth plugin eventually, but I don't want to pull myself in too many directions at the moment.
I didn't realize that wxBasic existed! I think I'll stick with wxPython since it seems so well-supported, but that's really cool that wx apps can be done in basic. I've been meaning to try out your DVDSlideshowGUI but haven't had a chance yet. Cheers, Shawn |
14th April 2005, 21:56 | #10 | Link |
Moderator
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
|
@Guest,
Trev created a small plugin (and i tweaked it a bit): http://www.geocities.com/wilbertdijkhof/AVIInfo_v02.zip It opens an avi without decompressing any frames, and is able to give info about the video/audio streams. It always outputs to a string. Example usage: Code:
# returns framerate of video clip = ... Value(clip.AVIInfo(framerate,1)) # value converts string to int (actually float i guess) # returns fourCC clip = ... clip.AVIInfo(fourCC,1) |
16th April 2005, 23:36 | #13 | Link |
BDVD Team
Join Date: Dec 2004
Location: Rio de Janeiro - RJ/Brasil
Posts: 306
|
@Wilbert
I´ve tried the AVIInfo plugin and it worked (almost) like a charm, because of a information about sample rate of audiostream was bogus (38 KHz instead of 44.1 KHz)... I've used in this way: Code:
c="movie.avi" BlankClip \Subtitle("Stream 1: " + c.AVIInfo("type",1),20,20). \Subtitle("Codec: " + c.AVIInfo("fourCC",1),20,40). \Subtitle("Framerate: " + c.AVIInfo("framerate",1),20,60). \Subtitle("# de frames: " + c.AVIInfo("length",1),20,80). \Subtitle("Largura: " + c.AVIInfo("width",1),20,100). \Subtitle("Altura: " + c.AVIInfo("height",1),20,120). \Subtitle("Stream 2: " + c.AVIInfo("type",2),20,140). \Subtitle("Samplerate: " + c.AVIInfo("framerate",2),20,160). \Subtitle("# de amostras: " + c.AVIInfo("length",2),20,180) Cheers, EDIT: I've tried the above script using a another avi file with framerate of 23.976 for video stream. AVIInfo returns 23.00000000 as the framerate value. So, I think that (perhaps) the rounding routine must be reviewed ... Last edited by danpos; 17th April 2005 at 00:06. |
17th April 2005, 04:18 | #14 | Link | |
AviSynth Enthusiast
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
|
Quote:
Wilbert: The documentation to AVIInfo is misleading; its first argument is a filename, not a clip. Looking through the code regarding that rounding error: Code:
float fps = float(psi.dwRate/psi.dwScale); Code:
float fps = float(psi.dwRate)/psi.dwScale; |
|
17th April 2005, 04:34 | #15 | Link |
budala
Join Date: Oct 2003
Location: U.S.
Posts: 545
|
@Wilbert,
Code:
//*** Change this **** float fps = float(psi.dwRate/psi.dwScale); // framerate (audio: samplerate) //*** To this **** float fps = float((float)psi.dwRate/(float)psi.dwScale); // framerate (audio: samplerate) @danpos AVIInfo is looking at the stream header. For Audio, the sample rate is also in the actual audio stream. This might be why you get 38 vs 44. Maybe the header level one is not the best to look at. I think wilbert is going to enhance AVIInfo to add channels for audio. Then he will be looking at the actual audio stream. -------------- damb ... stickboy pointed out the bug and I didn't even notice his post. Must be late. |
17th April 2005, 13:45 | #16 | Link | |||
Moderator
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
|
Oops. Thanks for your comments.
Quote:
Anyway, the following version should work properly http://www.wilbertdijkhof.com/AVIInfo_v03.zip @danpos, could you check it? The 38 KHz should also be fixed. @Trev, Quote:
Quote:
edit: updated link Last edited by Wilbert; 15th October 2010 at 21:31. |
|||
17th April 2005, 20:59 | #17 | Link | |
AviSynth Enthusiast
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
|
Quote:
Code:
enum info_t { type, fourCC, framerate, width, height, length, skew }; info_t info; // ... if (lstrcmpi(_info, "type") == 0) info = type; else if (lstrcmpi(_info, "fourCC") == 0) info = fourCC; // ... et cetera ... |
|
18th April 2005, 02:08 | #18 | Link |
BDVD Team
Join Date: Dec 2004
Location: Rio de Janeiro - RJ/Brasil
Posts: 306
|
@stickboy
Thanks for the hint about to output the AVIInfo informations to text file! @Trevlac Thanks for your support and good explanation about the question! @Wilbert I´ve tried the new version of plugin and it's returning the correct video stream framerate, but the audio stream sample rate remains bogus (now, I´ve tried with a .avi file which audio stream presents 48 KHz as sample rate ) ... BTW the plugin will help me a lot with a little utility that I´m developing for now ... Keep up the good work, mate! |
18th April 2005, 09:21 | #19 | Link | |
Moderator
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
|
Quote:
edit: ok. This happens with mp3 in avi (uncompressed audio in avi works fine). Last edited by Wilbert; 18th April 2005 at 22:21. |
|
20th April 2005, 01:18 | #20 | Link | |
BDVD Team
Join Date: Dec 2004
Location: Rio de Janeiro - RJ/Brasil
Posts: 306
|
Quote:
Cheers, |
|
|
|