Applescript to join video files

Discussion in 'Mac Programming' started by churchdemo, Apr 7, 2010.

  1. churchdemo macrumors newbie

    Joined:
    Apr 7, 2010
    #1
    I've got some avi files that I would like to join with applescript. Any help would be great.
     
  2. fredthefool macrumors newbie

    Joined:
    Jun 4, 2008
    #2
    I'm in doubt if AS could manage this on its own, but with QuickTime this is possible.

    Try this quick 'n dirty hack as template for your first approach:

    Code:
    set inFile1 to "yourVideo1.avi"
    
    set inFile2 to "yourVideo2.avi"
    
    tell application "QuickTime Player"
    	make new document
    	
    	open inFile1
    	tell document 1
    		rewind
    		select all
    		copy
    		select none
    	end tell
    	close document 1 saving no
    	
    	tell document 1
    		add
    		select none
    	end tell
    	
    	open inFile2
    	tell document 1
    		rewind
    		select all
    		copy
    		select none
    	end tell
    	close document 1 saving no
    	
    	tell document 1
    		add
    		select none
    	end tell
    	
    	export document 1 to "yourNewVideo.avi" as AVI
    	
    end tell
    

    You'll have to set up the paths to your own video files and the output file correctly, as in this example they're located in your root folder.

    In this case, there are only two files to concatenate, so if you want to process more of them, a loop would be better.

    Another possible issue i haven't solved yet is a quicktime timeout processing large videos.

    And maybe the script is working only with the pro-version of Quicktime: Some of the features of Quicktime Pro are accessible via AppleScript in QuickTime Player, some are not - i'm using QuickTime Pro and this works for me, so try it out.
     

Share This Page