NTKBO Posted February 26, 2011 Share Posted February 26, 2011 I'm trying to automate starting a "Count Down" video before meetings. One of the hard parts is figuring out the time to start the video so that it ends at a specified time. To have my script automatically figure this out, I need to find the duration of a video file.(I use the term "duration" to differentiate from "length" = 'space consumed for storage')I this code which works on MOST video, but NOT MP4, nor MOV.$FileName = '"C:\Documents and Settings\HP_Administrator\My Documents\My Videos\Loops\LP- terracing waterfall 1.mpg"' mciSendString("Open " & $FileName & " alias MediaFile") mciSendString("Set MediaFile time format milliseconds") $answer = mciSendString("Status MediaFile length") mciSendString("Close MediaFile") $Mins = int($Answer/60000) $Seconds = int($Answer/1000) $Secs = int($Seconds-($Mins*60)) MsgBox(4096,"file Duration","Duration - " &$Mins &"mn " &$Secs&"s") Func mciSendString($string) Local $ret $ret = DllCall("winmm.dll","int","mciSendString","str",$string,"str","","int",65534,"hwnd",0) If Not @error Then Return $ret[2] EndFunc(Many thanks to "Lakes " and "Larry" for posting this!)I haven't had much luck searching for similar postings, but figure one of the "media player" coders may have already solved this.(About 1/4 of my videos are MP4, and a few are MOV) Above code tested accurate with:MPG (1 & 2)AVI (MP4 video & MPC audio embedded in AVI DivX5 Format)MP3(The MP4 files tested were YouTube Downloads, and MOV is a quicktime format) Link to comment Share on other sites More sharing options...
iamtheky Posted February 27, 2011 Share Posted February 27, 2011 With an assist from ffmpeg... Im sure there is a nicer way than piping/parsing, but it works for all the filetypes i tried. $file = inputbox ("Which File" , "Select file") $time = runwait(@comspec & " /c " & "c:\ffmpeg -i " & '"' & $file & '"' & " 2>c:\pipe.txt") $timeFile = FileRead ("c:\pipe.txt") $timeArray = StringRegExp ($timeFile , "Duration: (\d\d:\d\d:\d\d)" , 3) msgbox (0, '' , $timeArray[0]) filedelete ("c:\pipe.txt") ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
NTKBO Posted February 27, 2011 Author Share Posted February 27, 2011 Thank you for your reply! After tracking down ffmpeg and downloading it pre-compiled, I was wholly unable to get your code to work. The error is likely to be mine. I placed ffmpeg.exe in "C:\", but it can't seem to locate any of the files I send it. I eventually got it to accept the path using FileGetShortName, but it still doesn't see it. I'm also curious why you wouldn't use ffprobe, but I was unable to get that to work either. It gets an error: >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\HP_Administrator\My Documents\AutoIt Proj\MediaLen2.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>17:43:35 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86) >Running AU3Check (1.54.19.0) from:C:\Program Files\AutoIt3 +>17:43:35 AU3Check ended.rc:0 >Running:(3.3.6.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\HP_Administrator\My Documents\AutoIt Proj\MediaLen2.au3" C:\Documents and Settings\HP_Administrator\My Documents\AutoIt Proj\MediaLen2.au3 (15) : ==> Subscript used with non-Array variable.: msgbox (0, '' , $timeArray[0]) msgbox (0, '' , $timeArray^ ERROR ->17:43:36 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 1.994 Output ("Pipe.txt") is: FFmpeg version SVN-r25512, Copyright (c) 2000-2010 the FFmpeg developers built on Oct 18 2010 04:06:45 with gcc 4.4.2 configuration: --enable-gpl --enable-version3 --enable-libgsm --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libmp3lame --enable-libopenjpeg --enable-libschroedinger --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-libvpx --arch=x86 --enable-runtime-cpudetect --enable-libxvid --enable-libx264 --extra-libs='-lx264 -lpthread' --enable-librtmp --extra-libs='-lrtmp -lpolarssl -lws2_32 -lwinmm' --target-os=mingw32 --enable-avisynth --cross-prefix=i686-mingw32- --cc='ccache i686-mingw32-gcc' --enable-memalign-hack libavutil 50.32. 3 / 50.32. 3 libavcore 0. 9. 1 / 0. 9. 1 libavcodec 52.92. 0 / 52.92. 0 libavformat 52.83. 0 / 52.83. 0 libavdevice 52. 2. 2 / 52. 2. 2 libavfilter 1.52. 0 / 1.52. 0 libswscale 0.12. 0 / 0.12. 0 C:\Documents and Settings\HP_Administrator\My Documents\My Videos\Loops\3m basic No music -CD.mp4: No such file or directory The code I used: Global $file, $time, $timeFile, $timeArray[12]=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ;$file = inputbox ("Which File" , "Select file") $File = FileGetShortName("C:\Documents and Settings\HP_Administrator\My Documents\My Videos\Loops\3m basic No music -CD.mp4") $time = runwait(@comspec & " /c " & "c:\ffmpeg -i " & '"' & $file & '"' & " 2>c:\pipe.txt") ;$time = runwait(@comspec & " /c " & "c:\ffprobe -pretty " & '"' & $file & '"' & " 2>c:\pipe.txt") $timeFile = FileRead ("c:\pipe.txt") $timeArray = StringRegExp ($timeFile , "Duration: (\d\d:\d\d:\d\d)" , 3) msgbox (0, '' , $timeArray[0]) ;filedelete ("c:\pipe.txt")(I hard coded the file because the InputBox was a pain for repetitive testing.) Link to comment Share on other sites More sharing options...
iamtheky Posted February 27, 2011 Share Posted February 27, 2011 (edited) I'd never heard of ffprobe, looks nice, thanks. And dont know why its not working, I tried with all sorts of paths and names and its not breaking for me. (and you can always set a default value in the inputbox, for the repetitive testing action) Edited February 27, 2011 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
smartee Posted February 27, 2011 Share Posted February 27, 2011 (edited) Try placing "ffprobe.exe" in the same directory as your script, and having no spaces in the path to your script. Then try omitting the "-i" parameter; which gives something like this: Func _durGet($thisVid) $tempPipe=@ScriptDir&"\piped.tmp" ShellExecuteWait(@ComSpec,' /c ffprobe.exe "'&$thisVid&'" 2>'&$tempPipe) Return StringRegExp(FileRead($tempPipe), "Duration: (\d\d:\d\d:\d\d\.\d\d)", 3) EndFunc ;==>_durGet _ArrayDisplay(_durGet("C:\Videos\Sample.mp4")) EDIT: clumsy code & faulty grammar Edited February 27, 2011 by smartee Link to comment Share on other sites More sharing options...
wakillon Posted February 27, 2011 Share Posted February 27, 2011 (edited) You can use MediaInfo.dll ! #include <Array.au3> $_InfoArray = _GetInfoArrayByMediaInfodll ( 'D:\video.mp4' ) _ArrayDisplay ( $_InfoArray ) $_InfoString = _ExtractInfoOfMediaInfodllArray ( $_InfoArray, 'playtime' ) ConsoleWrite ( $_InfoString & @Crlf ) Func _GetInfoArrayByMediaInfodll ( $_MediaFilePath ) If Not FileExists ( @SystemDir & '\MediaInfo.dll' ) Then FileInstall ( 'MediaInfo.dll', @SystemDir & '\MediaInfo.dll' ) $_Dll = DllOpen ( "MediaInfo.dll" ) $_Handle = DllCall ( $_Dll, "ptr", "MediaInfo_New" ) DllCall ( $_Dll, "int", "MediaInfo_Open", "ptr", $_Handle[0], "wstr", $_MediaFilePath ) DllCall ( $_Dll, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Complete", "wstr", "1" ) $_Inform = DllCall ( $_Dll, "wstr", "MediaInfo_Inform", "ptr", $_Handle[0], "int", 0 ) DllClose ( $_Dll ) $_Return = StringSplit ( $_Inform[0], @lf ) If Not @error Then Return $_Return Else Return 0 EndIf EndFunc ;==> _GetInfoArrayByMediaInfodll ( ) Func _ExtractInfoOfMediaInfodllArray ( $_InfoArray, $_Find ) For $_E = 1 To Ubound ( $_InfoArray ) - 1 If StringInStr ( $_InfoArray[$_E], $_Find ) Then Return $_InfoArray[$_E] Next Return 0 EndFunc ;==> _ExtractInfoOfMediaInfodllArray ( )Information you can get from MediaInfo :General: title, author, director, album, track number, date, duration...Video: codec, aspect, fps, bitrate...Audio: codec, sample rate, channels, language, bitrate...Text: language of subtitleChapters: number of chapters, list of chaptersFormat (container) does MediaInfo support :Video: MKV, OGM, AVI, DivX, WMV, QuickTime, Real, MPEG-1, MPEG-2, MPEG-4, DVD (VOB)...(Codecs: DivX, XviD, MSMPEG4, ASP, H.264, AVC...)Audio: OGG, MP3, WAV, RA, AC3, DTS, AAC, M4A, AU, AIFF...Subtitles: SRT, SSA, ASS, SAMI... Edited February 27, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
dynamitemedia Posted March 2, 2015 Share Posted March 2, 2015 wakillon i have tried using this script and all i get is this error.... at first i thought cause i had pointed to the .dll without installing ( will that work) and even after installing media info i get the same error: ==> Subscript used on non-accessible variable.: DllCall ( $_Dll, "int", "MediaInfo_Open", "ptr", $_Handle[0], "wstr", $_MediaFilePath ) DllCall ( $_Dll, "int", "MediaInfo_Open", "ptr", $_Handle^ ERROR >Exit code: 1 Time: 0.4139 only change i made was the location of the file location like here: $_InfoArray = _GetInfoArrayByMediaInfodll ( 'C:\Documents and Settings\admin\Desktop\recordings\Big 10 Network_11_26_22_32_2014.flv' ) Link to comment Share on other sites More sharing options...
dynamitemedia Posted March 2, 2015 Share Posted March 2, 2015 (edited) i have even tried using ffprobe like this but im just getting zero back $rName = "World of Martial Arts Television_11_11_02_32_2014.flv" $rVideo = $recordings & "\" & $rName $ffmpegProbe = '"' & $ffprobe & '" -v error -show_format -of flat=s=_ -show_entries format=duration "'& $rVideo &'" ' $command = 'cmd /k "' & $ffmpegProbe & '" ' local $PID = Run($command, @ScriptDir, @SW_show, 0x08) $line = StdoutRead($PID) ;read stdout $return = StringRegExp($line,"format_duration=22.168000", 1) ConsoleWrite($line & @CRLF) i can see in the console this info tho: format_duration="22.168000" format_tags_length="25992064" format_tags_language="eng" format_tags_timescale="48000" format_tags_sampletype="mp4a" format_tags_audiochannels="2" format_tags_videoframerate="25" format_tags_aacaot="2" format_tags_avclevel="30" format_tags_avcprofile="66" format_tags_frameWidth="876" format_tags_frameHeight="480" format_tags_displayWidth="853" format_tags_displayHeight="480" format_tags_moovposition="57041862" format_tags_encoder="Lavf56.12.103" I would much rather use ffProbe if possible as it is a easy portable file im usig esamples as shown here:https://trac.ffmpeg.org/wiki/FFprobeTips eval $(ffprobe -v error -show_format -of flat=s=_ input.mkv | grep format_duration); echo $format_duration Alternatively you can omit grep by using the -show_entries option: eval $(ffprobe -v error -show_format -of flat=s=_ -show_entries format=duration input.mkv); echo $format_duration Edited March 2, 2015 by dynamitemedia Link to comment Share on other sites More sharing options...
Kyan Posted March 2, 2015 Share Posted March 2, 2015 Did you downloaded MediaInfo.dll and putted it in C:\Windows\System32\ or c:WindowsSysWOW64 if you have x64 windows? Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better Link to comment Share on other sites More sharing options...
dynamitemedia Posted March 2, 2015 Share Posted March 2, 2015 Did you downloaded MediaInfo.dll and putted it in C:\Windows\System32\ or c:WindowsSysWOW64 if you have x64 windows? Actually i will check when i get home, i just installed the program... can i put the .dll anywhere as long as its pointing at it? and does it need to have the program installed? Link to comment Share on other sites More sharing options...
dynamitemedia Posted March 3, 2015 Share Posted March 3, 2015 ok i changed a little code around and now see the correct info in the editor $rVideo = $recordings & "\" & $rName $ffmpegProbe = '"' & $ffprobe & '" -v error -show_format -of flat=s=_ -show_entries format=duration "'& $rVideo &'" ' $command = 'cmd /k "' & $ffmpegProbe & '" ' local $PID = Run($command, @ScriptDir, @SW_show, $STDERR_CHILD) $line = StdoutRead($PID) ;read stdout and this is coming up in the console write of the editor format_duration="22.168000" format_tags_length="25992064" format_tags_language="eng" format_tags_timescale="48000" format_tags_sampletype="mp4a" format_tags_audiochannels="2" format_tags_videoframerate="25" format_tags_aacaot="2" format_tags_avclevel="30" format_tags_avcprofile="66" format_tags_frameWidth="876" format_tags_frameHeight="480" format_tags_displayWidth="853" format_tags_displayHeight="480" format_tags_moovposition="57041862" format_tags_encoder="Lavf56.12.103" so how do i get the "22.168000"" info from $line : $line = StdoutRead($PID) ;read stdout when it comes back format_duration="22.168000" Link to comment Share on other sites More sharing options...
TheSaint Posted March 3, 2015 Share Posted March 3, 2015 Haven't got my code on hand, but I use the CLI (Command-line) version of Media Info, as the regular won't work. It is a separate download, and sometimes difficult to find, but I either got it through Sourceforge or the Home page. It writes a single entry to a text file, which you can then read. It can be a bit tricky to understand the command-line usage, so tomorrow, if I remember, and you haven't had success yet, I will dig it out and post here. Simpler than wakillon's code, but I'm interested in the DLL method he's used, for I wasn't aware there was another way. dynamitemedia 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
TheSaint Posted March 3, 2015 Share Posted March 3, 2015 (edited) Here's my code, extracted from a much bigger script. Also note, that this for Audio duration, so you will need to chase up the different command(s) for Video. I don't have the correct version of Media Info installed on this PC, so cannot currently check for you. MediaInfo CLI 0.7.70 (http://MediaArea.net/MediaInfo) This first bit of code, you might find useful, in regards to setting Media Info location and variable assignments. expandcollapse popupGlobal $ans, $audlog, $inifle, $medfle, $mediainfo, $pth, $time, $version $inifle = @ScriptDir & "\Settings.ini" $medfle = @ScriptDir & "\Medlog.txt" $mediainfo = IniRead($inifle, "MediaInfo", "path", "") If $mediainfo = "" Or Not FileExists($mediainfo) Then $mediainfo = @ScriptDir & "\MediaInfo_CLI\MediaInfo.exe" If FileExists($mediainfo) Then IniWrite($inifle, "MediaInfo", "path", $mediainfo) Else $mediainfo = @ProgramFilesDir & "\MediaInfo\MediaInfo.exe" While 1 If FileExists($mediainfo) Then $version = FileGetVersion($mediainfo, "InternalName") If StringInStr($version, " - CLI - ") > 0 Then IniWrite($inifle, "MediaInfo", "path", $mediainfo) ExitLoop Else $mediainfo = "" EndIf Else $pth = FileOpenDialog("Choose the MediaInfo CLI executable file", @ProgramFilesDir, "Program file (*.exe)", 3, "MediaInfo.exe") If @error <> 1 And $pth <> "" And StringMid($pth, 2, 2) = ":\" Then $mediainfo = $pth $version = FileGetVersion($mediainfo, "InternalName") If StringInStr($version, " - CLI - ") > 0 Then IniWrite($inifle, "MediaInfo", "path", $mediainfo) ExitLoop Else $mediainfo = "" $ans = MsgBox(262193, "Version Error", _ "Selected file is not the CLI version of MediaInfo." & @LF & @LF & _ "Both the CLI and GUI versions have the same" & @LF & _ "executable name, but only the command-line" & @LF & _ "version (CLI) will work with this program." & @LF & @LF & _ "Do you want to browse for it again?", 0) If $ans = 2 Then $mediainfo = @ScriptDir & "\MediaInfo_CLI" DirCreate($mediainfo) $mediainfo = "" Exit EndIf EndIf Else $mediainfo = @ScriptDir & "\MediaInfo_CLI" DirCreate($mediainfo) $mediainfo = "" MsgBox(262192, "Program Error", "MediaInfo CLI (command-line version) freeware is required!") Exit EndIf EndIf WEnd EndIf EndIf This next bit of code, is the important bit. Func GetAudioDuration($pth) RunWait($mediainfo & ' "--Inform=General;Duration is: %Duration/String3%" --LogFile="' & $medfle & '" "' & $pth & '"', "", @SW_HIDE) Sleep(200) _FileReadToArray($medfle, $audlog) If @error = 0 Then $time = StringReplace($audlog[1], "Duration is: ", "") $time = StringTrimLeft($time, 1) Else $time = "" EndIf EndFunc ;=> GetAudioDuration Obviously you call it with something like. GetAudioDuration("C:\My Documents\Videos\My Video.mp4") NOTE - You will need to make alterations (rename a few things, etc) to my code, to suit your requirements. EDIT Actually, it seems that Duration/String3 is correct (same commands as audio), going by this extraction from CL_Help.txt Video; mpg,vob,ts avi or mp4 mp4 only mp4 or mkv wmv only wmv only flv only Format Format used MPEG Video MPEG-4 Visual MPEG-4 Visual AVC WVP2 VC-1 H.263 or VP6 Format/Info Info about Format Advanced Video Codec Format_Version Version of this format Version 2 Format_Profile Profile of the Format Main@Main Streaming Video@L1 Simple@Ln Main@L4.n MP@ML Main@High High@L3.1 CodecID Codec ID (found in some containers) XVID or DX50 MP4V V_MPEG4/ISO/AVC WVP2 WMV3 CodecID/Hint A hint for this codec ID XviD or DivX 5 WMV3 Duration Play time of the stream 729578 Duration/String Play time (formated) 12mn 9s Duration/String1 Play time in : HHh MMmn SSs MMMms 12mn 9s 78ms Duration/String2 Play time in format : HHh MMmn SSs 12mn 9s Duration/String3 Play time in format : HH:MM:SS.MMM 12:10.0 You may need to replace Inform=General with Inform=Video Edited March 3, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
BrewManNH Posted March 3, 2015 Share Posted March 3, 2015 Do the files show the duration in the file properties fields? Might be easier to find them that way if they do. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
TheSaint Posted March 3, 2015 Share Posted March 3, 2015 (edited) Probably not for MP4 or even MOV going by my recollection. My experience though, is with Win XP. Edited March 3, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
BrewManNH Posted March 3, 2015 Share Posted March 3, 2015 I don't have either type on any computer, so I couldn't tell. Worth a shot. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
TheSaint Posted March 3, 2015 Share Posted March 3, 2015 (edited) Could be worth a try for the OP, as it would simplify things if it worked. >_FileGetProperty One of yours too, and in your signature. I still use the old original in a few scripts .... just haven't updated yet. Edited March 3, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
dynamitemedia Posted March 4, 2015 Share Posted March 4, 2015 Guys love the help for rea l!! but im married to this ffProbe/ffmpeg been messing with _StringBetween but cant seem to figure out how to read what is coming out of ffprobe or ffmpeg now this is hard coded for example... and works Local $duration =' format_duration="22.168000" format_tags_length="25992064" format_tags_language="eng" ' $left = 'format_duration="' $right = '"' $source = _StringBetween($duration, $left,$right) If Not @error Then MsgBox(0,"",""& $source[0]) Else MsgBox(0,""," No Time came back ") EndIf and the code i am using once again is this which prints out line per line $rVideo = $recordings & "\" & $rName $ffmpegProbe = '"' & $ffprobe & '" -v error -show_format -of flat=s=_ -show_entries format=duration "'& $rVideo &'" ' $command = 'cmd /k "' & $ffmpegProbe & '" ' local $PID = Run($command, @ScriptDir, @SW_show, $STDERR_CHILD) $line = StdoutRead($PID) ;read stdout but i just want it all into one variable so that _stringBetween will read it Thanks so much but ffprobe is very easy to include with no install to the end user Link to comment Share on other sites More sharing options...
TheSaint Posted March 4, 2015 Share Posted March 4, 2015 Sorry, I misunderstood who was asking the question. You asked a question of wakillon who last posted in this topic over 4 years ago. My experience is with Media Info, not ffprobe. Going by your last line in Post #11 format_duration="22.168000" You could just use StringSplit with a double quote. $line = 'format_duration="22.168000"' $duration = StringSplit($line, '"') $duration = $duration[2] Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Kyan Posted March 4, 2015 Share Posted March 4, 2015 (edited) hey fellow, you can use StringRegExp for the job #include <Array.au3> $aRex=StringRegExp($stdout,'^(.+?)="(.+?)$"',3) local $aOutput[1][2] For $i = 0 to ubound($aRex)-1 Step 2 Redim $aOutput[$i/2+1][2] $aOutput[$i/2][0]=$aRex[$i] $aOutput[$i/2][1]=$aRex[$i+1] Next _ArrayDisplay($aOutput) Exit Edited March 4, 2015 by Kyan Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now