svennie Posted October 17, 2005 Share Posted October 17, 2005 (edited) New version avaible: Version 1.3Whats changed?Bug fix: Fixed problems with _MediaSave function (thanks to Emperor!)New version avaible: Version 1.2Whats changed?Bug fix: You can now play files with spaces in ther pathname.New version avaible: Version 1.1Whats changed?New _MediaCut functionNew _MediaCopy functionNew _MediaPaste functionNew _MediaDelete functionNew _MediaCapture function--------Hello,This UDF makes it possible to do a lot of things with Media files, like:- Play sounds- Play movies in Fullscreen, reversed, set the speed etc.- Record sounds from a microphone- Save files- Cut, copy, paste, delete etc in media files.And much more.Here are the functions:;=============================================================================== ; ; Function Name: _MediaOpen() ; Description: Opens a media file. ; Parameter(s): $s_location - Location of the media file ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns Media ID needed for the other media functions ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaCreate() ; Description: Creates a new media for recording, capturing etc. ; Parameter(s): $s_format - Format of the file. ; 0 = CD Audio ; 1 = Digital video ; 2 = Overlay ; 3 = sequencer ; 4 = Vcr ; 5 = Video disc ; 6 = Wave Audio ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns Media ID needed for the other media functions ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaPlay() ; Description: Plays a opened media file. ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; [optional] $i_From - Sets time in seconds where to begin playing ; [optional] $i_To - Sets time in seconds where to bstop playing ; [optional] $i_Speed - Sets the speed to play with ; [optional] $f_Fast - When 1 it will play faster then normal ; [optional] $f_Slow - When 1 it will play slower then normal ; [optional] $f_Fullscreen - When 1 movies will play fullscreen ; [optional] $f_Repeat - When 1 it will keep repeating ; [optional] $f_Reverse - When 1 the movie will been played reversed ; [optional] $f_Scan - When 1 plays as fast as possible ; The default value of all the optional parameters is 0. ; Some file formats dont understand some of the optional functions ; Experimate with it. ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaRecord() ; Description: Records from a microphone ; Stop recording with _MediaStop() ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaCut() ; Description: Cuts a specified part of the movie to the clipboard. ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; $i_From - From time in seconds ; $i_To - To time in seconds ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaCopy() ; Description: Copies a specified part of the movie to the clipboard. ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; $i_From - From time in seconds ; $i_To - To time in seconds ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaPaste() ; Description: Paste media from the clipboard. ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaDelete() ; Description: Deletes a specified part of the movie. ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; $i_From - From time in seconds ; $i_To - To time in seconds ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaCapture() ; Description: Copies the contents of the frame buffer and stores it in the ; specified file. ; Stop recording with _MediaStop() ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; $s_Location - Location where to store the file. ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaStop() ; Description: Stops playing/recording of a Media ID ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaSeek() ; Description: Moves to a specified Position and stops. ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; $i_Position - Position in seconds to move to, -1 goes to start ; -2 goes to end ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaPause() ; Description: Pauses playing/recording of a Media ID ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaResume() ; Description: Resumes playing/recording of a Media ID ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaSave() ; Description: Saves a opened Media ID to the selected file ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; $s_Location - Location to save to (must be full path) ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================;=============================================================================== ; ; Function Name: _MediaClose() ; Description: Closes a existing Media ID ; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate() ; Requirement(s): AutoIt ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @ERROR = 1 ; Author(s): svennie ; ;===============================================================================The examples included doesnt view all the functions, only the following:_MediaOpen_MediaPlay_MediaStop_MediaClose_MediaCreate_MediaRecord_MediaSaveIf you create a example please post it .Be sure you always use _MediaClose at te end of your script, or in the OnAutoItExit function.When you not close the media file, the next time you run the application it will not work.Since it is trying to open it in the first handle and it is still filled from the time we runned the program before .Put the Media.au3 in your Include directory and enjoy!Please tell me what you think about it and give me some feedback .Number of downloads v1.2: 769Media_Example_PlayFile.au3Media_Example_RecordSound.au3Media.au3 Edited June 21, 2007 by svennie Sorry for my English, I'm Dutch... =DMedia UDFINet Adv UDF Link to comment Share on other sites More sharing options...
Mason Posted October 17, 2005 Share Posted October 17, 2005 Haven't been able to test them, but if they work...you my friend should be given an award. The recording functions are excactly what I have been looking for. I love you. Link to comment Share on other sites More sharing options...
gamerman2360 Posted October 17, 2005 Share Posted October 17, 2005 (edited) Can it play URLs? Can't test it now but try playing .pls(playlist) or this URL.URL: http://205.188.234.2:8040pls: attached, not permitted, download the txt then change the extention.It runs in winamp! To read the pls in notepad you may have to change the LF returns to something else.Edit: http://64.236.34.4/stream/1074 is the redirect of the other URLshoutcast_playlist.txt Edited October 17, 2005 by gamerman2360 Link to comment Share on other sites More sharing options...
svennie Posted October 18, 2005 Author Share Posted October 18, 2005 Can it play URLs? Can't test it now but try playing .pls(playlist) or this URL.URL: http://205.188.234.2:8040pls: attached, not permitted, download the txt then change the extention.It runs in winamp! To read the pls in notepad you may have to change the LF returns to something else.Edit: http://64.236.34.4/stream/1074 is the redirect of the other URLI cannot test it at the moment, it says the server is full Sorry for my English, I'm Dutch... =DMedia UDFINet Adv UDF Link to comment Share on other sites More sharing options...
svennie Posted October 18, 2005 Author Share Posted October 18, 2005 Released version 1.1 of the UDF, see first post . Sorry for my English, I'm Dutch... =DMedia UDFINet Adv UDF Link to comment Share on other sites More sharing options...
peter1234 Posted October 19, 2005 Share Posted October 19, 2005 Wow. This is great. I just wish I could get it to work. Tried version 1.1 Media_Example_PlayFile.au3 with AVI and WAV files but it would not play any of them. Seems to exit after selecting file. Link to comment Share on other sites More sharing options...
svennie Posted October 19, 2005 Author Share Posted October 19, 2005 (edited) Wow. This is great. I just wish I could get it to work. Tried version 1.1 Media_Example_PlayFile.au3 with AVI and WAV files but it would not play any of them. Seems to exit after selecting file.Very weird, on my pc it just works. Have you placed Media.au3 in your include directory (default C:/Program Files/AutoIt/Include)EDIT: Found a bug, when you load a file with spaces in the pathname it will not work. This will been fixed in 1.2EDIT: Released version 1.2, see first post Edited October 19, 2005 by svennie Sorry for my English, I'm Dutch... =DMedia UDFINet Adv UDF Link to comment Share on other sites More sharing options...
busysignal Posted October 19, 2005 Share Posted October 19, 2005 I am trying to download some files but it seems that there are some problems.. Please check the links to see if the files exist.. Media.au3 ( 10.08k ) <== Cannot Download Media_Example_PlayFile.au3 <== Download Ok Media_Example_RecordSound.au3 <== Cannot Download I would like to try it but the links have a problem.. Thanks.. Cheers.. Link to comment Share on other sites More sharing options...
peter1234 Posted October 19, 2005 Share Posted October 19, 2005 YEH! I had Media.au3 in same folder as Media_Example_PlayFile.au3 thinking it would be found there. When I moved it to the Include folder in the program file folder it works (sort of). Videos play but video window does not close at end of file. Thanks for your help and for generating these. Does program close video window at end of file for you? Link to comment Share on other sites More sharing options...
svennie Posted October 19, 2005 Author Share Posted October 19, 2005 (edited) YEH! I had Media.au3 in same folder as Media_Example_PlayFile.au3 thinking it would be found there. When I moved it to the Include folder in the program file folder it works (sort of). Videos play but video window does not close at end of file. Thanks for your help and for generating these. Does program close video window at end of file for you?Yes, if you not set the repeat parameter . Edited October 19, 2005 by svennie Sorry for my English, I'm Dutch... =DMedia UDFINet Adv UDF Link to comment Share on other sites More sharing options...
svennie Posted October 19, 2005 Author Share Posted October 19, 2005 (edited) I am trying to download some files but it seems that there are some problems.. Please check the links to see if the files exist.. Media.au3 ( 10.08k ) <== Cannot Download Media_Example_PlayFile.au3 <== Download Ok Media_Example_RecordSound.au3 <== Cannot DownloadI would like to try it but the links have a problem.. Thanks..Cheers.. They just work for me .What you see when you try to download them?EDIT: Putted them on my fileman, see first post. Edited October 19, 2005 by svennie Sorry for my English, I'm Dutch... =DMedia UDFINet Adv UDF Link to comment Share on other sites More sharing options...
busysignal Posted October 19, 2005 Share Posted October 19, 2005 They just work for me .What you see when you try to download them?EDIT: Putted them on my fileman, see first post.@Svennie, works now thanks. Not sure what the deal was before.. Now I can play.. Thanks!Cheers.. Link to comment Share on other sites More sharing options...
slipperylobster Posted October 19, 2005 Share Posted October 19, 2005 It works!! Thank you sir! Link to comment Share on other sites More sharing options...
poisonkiller Posted October 19, 2005 Share Posted October 19, 2005 How can i do this: One .mp3 plays and when its over an other starts to playing. How can i read, when music is over? Link to comment Share on other sites More sharing options...
WhiteCrow Posted October 27, 2005 Share Posted October 27, 2005 Nice work man, just what i was looking for Link to comment Share on other sites More sharing options...
Kapz Posted November 9, 2005 Share Posted November 9, 2005 I was wondering if it might be possible to create a command that records from another input rather than just the microphone....say for example the audio output of your computer?.....would it record as an mp3 or possibly convert a wav into an mp3 later on? Thanks. Link to comment Share on other sites More sharing options...
DiskAI Posted November 11, 2005 Share Posted November 11, 2005 expandcollapse popupOption Explicit 'Requires a reference to: ' Microsoft Shell Controls and Automation (shell32.dll) 'Uses techniques found here: 'http://www.microsoft.com/resources/documentation/windows/2000/server/scriptguide/en-us/sas_fil_lunl.mspx Public objShell As IShellDispatch4 Public Type BROWSEINFO hOwner As Long pidlRoot As Long pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type '32-bit API declarations Declare Function SHGetPathFromIDList Lib "shell32.dll" _ Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) _ As Long Declare Function SHBrowseForFolder Lib "shell32.dll" _ Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long Sub DisplayMP3Info() Dim i As Long Dim Folder As String Dim StrLen As Long, FolderLen As Long Dim NameOnly As String Dim Row As Long ' Prompt for the directory Folder = GetDirectory("Select a directory that has MP3 files") Set objShell = CreateObject("Shell.Application") FolderLen = Len(Folder) With Application.FileSearch .NewSearch .LookIn = Folder .SearchSubFolders = True .FileType = msoFileTypeAllFiles If .Execute > 1 Then If .FoundFiles.Count = 0 Then MsgBox "Error - No files.", vbCritical GoTo ExitSub Exit Sub End If Row = 1 Worksheets("Sheet1").Activate ActiveSheet.Cells.Clear With ActiveSheet.Range("A1:K1") .Value = Array("Path", "Filename", "Size", "Date/Time", "Artist", "Album Title", "Year", "Track No.", "Genre", "Duration", "Bit Rate") .Font.Bold = True End With Application.ScreenUpdating = False For i = 1 To .FoundFiles.Count If i Mod (100) = 0 Then DoEvents Application.StatusBar = "Working on " & i & " of " & .FoundFiles.Count End If If Right(.FoundFiles(i), 3) = "mp3" Then Row = Row + 1 'Parse the directory path to get genre, artist, and album name, and song title ActiveSheet.Cells(Row, 1) = .FoundFiles(i) ActiveSheet.Cells(Row, 2) = FileNameOnly(.FoundFiles(i)) ActiveSheet.Cells(Row, 3) = FileLen(.FoundFiles(i)) ' file size ActiveSheet.Cells(Row, 4) = FileDateTime(.FoundFiles(i)) 'date ActiveSheet.Cells(Row, 5) = GetMP3TagInfo(.FoundFiles(i), 16) 'artist ActiveSheet.Cells(Row, 6) = GetMP3TagInfo(.FoundFiles(i), 17) 'album title ActiveSheet.Cells(Row, 7) = GetMP3TagInfo(.FoundFiles(i), 18) 'year ActiveSheet.Cells(Row, 8) = GetMP3TagInfo(.FoundFiles(i), 19) 'track number ActiveSheet.Cells(Row, 9) = GetMP3TagInfo(.FoundFiles(i), 20) 'duration ActiveSheet.Cells(Row, 10) = GetMP3TagInfo(.FoundFiles(i), 21) 'genre ActiveSheet.Cells(Row, 11) = GetMP3TagInfo(.FoundFiles(i), 22) 'bit rate End If Next i End If End With ExitSub: 'update the pivot table ActiveSheet.UsedRange.Name = "Data" Worksheets("pivot").PivotTables("PivotTable1").PivotCache.Refresh Set objShell = Nothing Application.StatusBar = False End Sub Function GetMP3TagInfo(FolderName, ItemNum) Dim strFilename Dim objFolder As Folder3 Dim objFolderItem As FolderItem2 Dim FileName As String FileName = FileNameOnly(FolderName) Set objFolder = objShell.Namespace(Left(FolderName, Len(FolderName) - Len(FileName))) Set objFolderItem = objFolder.ParseName(FileName) GetMP3TagInfo = objFolder.GetDetailsOf(objFolderItem, ItemNum) End Function Function FileNameOnly(FullPath) As String Dim i As Long Dim FN As String If Right(FullPath, 1) = "\" Then FullPath = Left(FullPath, Len(FullPath) - 1) For i = Len(FullPath) To 1 Step -1 If Mid(FullPath, i, 1) = "\" Then FileNameOnly = FN Exit Function Else FN = Mid(FullPath, i, 1) & FN End If Next i End Function Function GetDirectory(Optional Msg) As String Dim bInfo As BROWSEINFO Dim path As String Dim r As Long, x As Long, pos As Integer ' Root folder = Desktop bInfo.pidlRoot = 0& ' Title in the dialog If IsMissing(Msg) Then bInfo.lpszTitle = "Select a folder." Else bInfo.lpszTitle = Msg End If ' Type of directory to return bInfo.ulFlags = &H1 ' Display the dialog x = SHBrowseForFolder(bInfo) ' Parse the result path = Space$(512) r = SHGetPathFromIDList(ByVal x, ByVal path) If r Then pos = InStr(path, Chr$(0)) GetDirectory = Left(path, pos - 1) Else GetDirectory = "" End If End Function can someone extract the function in this code .. it might help in getting info off mp3s i think Link to comment Share on other sites More sharing options...
svennie Posted November 11, 2005 Author Share Posted November 11, 2005 (edited) Because everyone want to save as MP3 i will add a convert function (or let you immediatly save as mp3) to the next version . Edited November 11, 2005 by svennie Sorry for my English, I'm Dutch... =DMedia UDFINet Adv UDF Link to comment Share on other sites More sharing options...
poisonkiller Posted November 11, 2005 Share Posted November 11, 2005 Is there any way to convert .wma to .mp3? I tried FileCopy() , but its not working. Link to comment Share on other sites More sharing options...
svennie Posted November 11, 2005 Author Share Posted November 11, 2005 Is there any way to convert .wma to .mp3? I tried FileCopy() , but its not working.Do you mean WAV instead of WMA?If so:Because everyone want to save as MP3 i will add a convert function (or let you immediatly save as mp3) to the next version .And if you really mean WMA please say :"> Sorry for my English, I'm Dutch... =DMedia UDFINet Adv UDF 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