Åmbrosius 0 Posted May 25, 2010 Greetings once again oh great and wise ones. hopefully you can nudge or shove me in the right direction. Honestly do not have the faintest idea where to even start experimenting on this one. I have a collection of captured files in flash .flv format, I need to write a script that can tell whether or not each .flv has a video track or not, and then separate them into different folders. Also have one or two that have no audio, just video, but the theory should be the same to check that. Is there a way Autoit could read that info directly from the FLV, or intercept the command prompt output of FLVtool or preferably FFMpeg? I'm having to do this manually and honestly cannot face continuing at that pace. Plus it seemed like a great task to batch automate, until I tried. Thanks in advance! Share this post Link to post Share on other sites
evilertoaster 3 Posted May 25, 2010 (edited) Hum, you should be able to extrapolate what you need from this example: $header = FLV_GetHeader("barsandtone.flv") MsgBox(0,"",FLVHeader_GetStreams($header)) func FLVHeader_GetStreams($flvHeader) MsgBox(0,"",UBound($flvHeader)) if UBound($flvHeader)<4 then return -1 Local $tFlags=$flvHeader[2] if $tFlags = 0x00 then return "None" if $tFlags = 0x01 then return "Video" if $tFlags = 0x04 then return "Audio" if $tFlags = 0x05 then return "Audio/Video" return -2 EndFunc func FLV_GetHeader($FilePath) local $tFile=FileOpen($FilePath,16) if $tFile = -1 then Return -1 local $tHeader=FileRead($tFile,9) local $returnVal[4] $returnVal[0]=BinaryMid($tHeader,1,3);Signature, "FLV" for valid flv files if ($returnVal[0]<>"0x464C56") then return -2 $returnVal[1]=BinaryMid($tHeader,4,1);Version, usually 0x01 for flv files $returnVal[2]=BinaryMid($tHeader,5,1);Flags, 0x00 if no streams, 0x01 for audio, 0x04 for video, 0x05 for audio+video $returnVal[3]=BinaryMid($tHeader,6,3);Header size (end of header maker), {0x00,0x00,0x00,0x09} for flv files return $returnVal EndFunc Edited May 25, 2010 by evilertoaster Share this post Link to post Share on other sites
Åmbrosius 0 Posted May 26, 2010 (edited) Hum, you should be able to extrapolate what you need from this example:I think you vastly overestimate my intelligence levels. Just running your script returns 4 then -2 whether audio is present or not. Will fiddle around with it, because I think I understand what it's doing, just need to understand how it's doing it.Thanks for your help, if I can figure this out I think you may well have cracked it.All hail evilertoaster Will post back once I figure it out, or get deeply confused EDIT :Yay! Thanks again. Okay so evidentally my FLV's are bizarre, returning 0x0D for Audio/Video and 0x09 for Video. Perhaps becasue I ran them all through FLVMdi to fix the durations.You are an absolute godsend. Thanks again evilertoaster! (Don't suppose you have any theories on how to change the FLV timecode intervals? Another manual task I hate ) Edited May 26, 2010 by Åmbrosius Share this post Link to post Share on other sites