Jump to content
Sign in to follow this  

HELP! Problem reading file properties

Recommended Posts

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

Hum, you should be able to extrapolate what you need from this example:

$header = FLV_GetHeader("barsandtone.flv")

func FLVHeader_GetStreams($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

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
Edited by evilertoaster

Share this post

Link to post
Share on other sites

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 :mellow:

Will post back once I figure it out, or get deeply confused :P


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 :party: )

Edited by Åmbrosius

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...