Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 24, 2010, 12:57 PM   #1
dduke
macrumors newbie
 
Join Date: Aug 2010
Merge QuickTime movies through code

Is there a way, either through coding or command line, to take two QuickTime movies and combine them into one.

I know that this can be done manually through QuickTime player, but we need to be able to do this using code or command line.

Thx for your help.
dduke is offline   0 Reply With Quote
Old Aug 24, 2010, 02:22 PM   #2
chown33
macrumors 603
 
Join Date: Aug 2009
I googled these search terms:
quicktime command line

The results look promising.

If those results are unsatisfactory, please provide a more detailed explanation.
chown33 is offline   0 Reply With Quote
Old Aug 24, 2010, 04:32 PM   #3
dduke
Thread Starter
macrumors newbie
 
Join Date: Aug 2010
@chown33

Thx for your reply.

We have tried you query multiple times and have not found a solution.

To be more specific, we are trying to implement a system for reducing the time that it takes to make a large movie by making pieces of the final product on multiple machines. Lets say we have 100,000 frames that we want to turn into a movie. We send a job out to 10 machines to 10 different ranges:

1 - 10,000
10,001 - 20,000
20,001 - 30,000
etc....

Now that we have the ten slices, we need to merge them together into one QuickTime movie encoded with the animation codec.

This must be done from the command line, or through coding as the process has to be automatic.

Does anyone know of a solution, or could at least point us to a place that does. We have exhausted Google with every variation of 'quicktime command line'.
dduke is offline   0 Reply With Quote
Old Aug 24, 2010, 05:41 PM   #4
subsonix
macrumors 68030
 
Join Date: Feb 2008
I would look into QTKit and Quicktime frameworks, loading the files, combining the buffers and saving to a new file can most certainly be done there I'd say.
subsonix is offline   0 Reply With Quote
Old Aug 24, 2010, 05:41 PM   #5
chown33
macrumors 603
 
Join Date: Aug 2009
Will any of these meet your requirements or not?
http://www.macupdate.com/info.php/id/22667/addmovie
http://www.macupdate.com/info.php/id/17601/qtcoffee
http://www.macupdate.com/info.php/id...oviecat-plugin

The first is more recently updated, but seems to require an activation code.

It looks like at least one of them may work, but since you haven't said anything about trying anything you might have found, you may have to try them first.

It's also possible that ImageMagick will work, but it seems more still-image oriented than movie-oriented, so that's just a wild guess.

If these don't meet your requirements, please provide more detail. Specifically:
  1. What price are you willing to pay, or must it be free?
  2. What is your command-line experience?
  3. What is your experience in making or modifying scripts (in any scripting language)? If it's non-zero, what language?
  4. What tools are you using to assemble the 10k frames into movies?
  5. Do the fragments to be assembled have audio or not?
  6. Summarize some of the tools you've evaluated and rejected (e.g. MovieStitch).

#3 doesn't need to be your personal experience, but someone else in your work group. I'm asking in order to have some idea of whether a close-but-not-exact script would be acceptable or not.

#4 is to know what your tools are, so we know what can be done with what you already have.


I found the above tools by visiting www.macupdate.com and searching it with terms like:
join movies
combine movies
movie command line
quicktime command
http://www.macupdate.com/
chown33 is offline   0 Reply With Quote
Old Aug 24, 2010, 11:41 PM   #6
HiRez
macrumors 601
 
HiRez's Avatar
 
Join Date: Jan 2004
Location: Western US
You're basically describing a distributed render farm. What you probably want to do is have the client machines render self-contained single frames in an appropriate losslessly-compressed format such as .tif or .png, then send all the frames back to a central server which stitches the frames together and encodes it as a QuickTime movie. Theoretically you could have each client make its own QuickTime but it might be easier to use individual frames. This can certainly be done through code using the QuickTime API, however one of the functions of the AppleScriptable QuickTime Player app is to read in a series of numbered still frames, which can then be saved out as a QuickTime movie with any encoding that QuickTime supports. So you might be able to achieve it with little more than some AppleScripting. But the hard part will be coordinating between all the clients and the server, making sure all the frames get rendered and are valid, etc.
__________________
Go outside, the graphics are amazing!
HiRez is offline   0 Reply With Quote
Old Aug 25, 2010, 10:37 AM   #7
dduke
Thread Starter
macrumors newbie
 
Join Date: Aug 2010
@chown
Yes those links are great I will have to investigate them. We have only tried solutions for PC but we have access to a mac.

Things that we have tried are the obvious ffmpeg, mencoder, and other pretty hacky things that aren't worth mentioning.
  1. At this point, I'm sure my company could spend money if it needed to. I don't have a solid number but we do have resources.
  2. I would call myself a novice command-liner
  3. I am a very experienced programmer. Languages I can use include java, j-script, vb.net, c#, python, c++, actionscript, aescript, vbscript. I'm probably leaving some out but that's all off the top of my head.
  4. We are using ffmpeg and a tool that comes with Royal Render 6(our render farm manager)
  5. The assembled fragments do not have audio, but the final product could depending on what project we are working on
  6. Tools we have evaluated are ffmpeg, mencoder, avimerge (don't even know why we tried that one), and some other windows based stuff. Haven't explored mac options but it looks like we are gonna have to go that route.

Thx for your reply and hopefully continued help

@HiRez

We are using a distributed render farm to make frames almost exactly as you described. We need to create uncompressed movies which can get very large (100,000+ frames at 5mb each = A LARGE MOVIE ). We are trying to find a way to decrease the amount of time that it takes to create an uncompressed movie by having multiple chunks of frames encoded on the farm and stitched together at the end. We have already implemented the part where we encode all the pieces. Now we just need a solution for combining them into one uncompressed movie for delivery to clients.

Thanks to you also.
dduke is offline   0 Reply With Quote
Old Aug 25, 2010, 11:26 AM   #8
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by dduke View Post
@chown
Yes those links are great I will have to investigate them. We have only tried solutions for PC but we have access to a mac.
If PCs are your primary machines, then you're kinda asking in the wrong place. This is a Mac Programming forum, not a PC movie-production forum. That doesn't mean people won't be willing to help, just that you're basically asking a bunch of Mac programmers, who may not be all that informed about PC movie-production products. The answers we provide are more likely to involve Macs and programming.

Hearing that you're using a commercial render-farm manager, I'm a little surprised it can't handle (or direct) the final sequencing. Maybe that's just my ignorance of the field.

Your list of languages looks good. I was hoping for AppleScript or bash (shell), but I don't think you'll get lost at the first command-line.

At this point, I think the next step is for you to tell us how the evaluation of the 3 suggested programs went. If you've paid for QuickTime Pro on a Mac, some other possibilities arise, such as AppleScripting the QuickTime Player app.
chown33 is offline   0 Reply With Quote
Old Aug 25, 2010, 01:15 PM   #9
dduke
Thread Starter
macrumors newbie
 
Join Date: Aug 2010
@chown

We have only tried solutions for pc, but we do have access to a mac, so a mac solution would be acceptable. I think we have Quicktime pro for mac, but if we don't we can purchase it.

Problems with what we tried:
ffmpeg can only concatenate avi's. Any other format is corrupted
mencoder had the same problem.

Those were the two main programs that we tried for over a month. I even tried to recode some of the libraries but that was pretty much a waste of time.

I'm sure that if AppleScript can merge multiple movies into one, then I won't have a problem picking it up. If so, do you have any suggestions of where to get go the procedure for what we need to do? I know that I could just google it but I was hoping you guys could give me a head start by pointing me in the right direction.
dduke is offline   0 Reply With Quote
Old Aug 25, 2010, 03:47 PM   #10
Peter Maurer
macrumors member
 
Join Date: Oct 2008
Try saving this as an AppleScript application (i.e., a droplet):

Code:
on open theMovieFiles
	tell application "Finder"
		set theSortedMovieFiles to sort theMovieFiles by name
	end tell
	tell application id "com.apple.quicktimeplayer"
		activate
		make new document
		repeat with aMovieFile in theSortedMovieFiles
			open (aMovieFile as alias)
			tell document 1
				rewind
				select all
				copy
				select none
			end tell
			close document 1 saving no
			tell document 1
				add
				select none
			end tell
		end repeat
		tell document 1
			rewind
		end tell
	end tell
end open
This script concatenates separate movie files into one QuickTime movie, and it requires QuickTime Player 7, as well as QuickTime Pro--I think. (I haven't worked on a Mac without QuickTime Pro in years, so I can't test.) Alternatively, you could do basically the same thing with QTKit (plus the underlying QuickTime framework for more sophisticated manipulations, if needed).

That alternative approach is way more complicated, though (working with the QuickTime framework can be very tricky), so I'd recommend staying with the script if it does everything you need. The fact that you can make this a part of more complex scripts (e.g., for saving the resulting movie) or even Automator actions might come in handy, too.

Last edited by Peter Maurer; Aug 25, 2010 at 03:55 PM. Reason: simplified script some more and added a note on QuickTime Pro.
Peter Maurer is offline   0 Reply With Quote
Old Aug 25, 2010, 06:57 PM   #11
ytk
macrumors regular
 
Join Date: Jul 2010
I've used a Ruby Gem called rmov for exactly this purpose. It's basically a wrapper around the C QuickTime API, and it works quite well for combining movies, modifying, adding, or deleting tracks, and so on.

http://rmov.rubyforge.org/

You didn't mention Ruby as one of the languages you are familiar with, but if you are an experienced programmer you should have no trouble figuring out what you need to do from the examples provided. Or even better, you can use the opportunity to learn Ruby, which is in my opinion the single handiest programming language available on the Mac.
ytk is offline   0 Reply With Quote
Old Aug 26, 2010, 09:44 AM   #12
dduke
Thread Starter
macrumors newbie
 
Join Date: Aug 2010
@Peter Maurer
That looks like it will work perfectly, thx!

@ytk
No I don't know ruby at all, but like you said I'm sure it wouldn't take long to pick up. I'll look at the samples you provided and see if there is a way to implement them in our production pipeline.
dduke is offline   0 Reply With Quote
Old Apr 6, 2011, 10:03 AM   #13
felix.brabant
macrumors newbie
 
Join Date: Apr 2011
Quote:
Originally Posted by Peter Maurer View Post
Try saving this as an AppleScript application (i.e., a droplet):

Code:
on open theMovieFiles
	tell application "Finder"
		set theSortedMovieFiles to sort theMovieFiles by name
	end tell
	tell application id "com.apple.quicktimeplayer"
		activate
		make new document
		repeat with aMovieFile in theSortedMovieFiles
			open (aMovieFile as alias)
			tell document 1
				rewind
				select all
				copy
				select none
			end tell
			close document 1 saving no
			tell document 1
				add
				select none
			end tell
		end repeat
		tell document 1
			rewind
		end tell
	end tell
end open
Hi Peter and everyone !

I've been looking for this for days ! Thanks a lot.

I'm not a pro in AppleScript and I'm getting to know and discover Automator, and I'm amazed by the really great tools we can creat with them.

I was wondering if you could help me with something. Is it possible for that script to remember the file name of the first file and than save the new file in the same location as OriginalName_Merge.mov or something like that ?

That would be wonderful

Félix
felix.brabant is offline   0 Reply With Quote
Old May 14, 2012, 10:13 PM   #14
mishamazor
macrumors newbie
 
Join Date: Dec 2007
Lion version?

This works great under Snow Leopard and not at all in Lion. Can someone please update it for the new OS?

Thx,
Misha
mishamazor is offline   0 Reply With Quote
Old May 14, 2012, 11:18 PM   #15
Red Menace
macrumors regular
 
Join Date: May 2011
Location: Littleton, Colorado, USA
Quote:
Originally Posted by mishamazor View Post
This works great under Snow Leopard and not at all in Lion. Can someone please update it for the new OS?
As mentioned, you will need QuickTime Player 7 with the Pro registration (this is not the same application as the default QuickTime Player).
__________________
MacBook Pro / OS X Mavericks (10.9.4) / Xcode 5.1.1 / RubyMotion FTW
Red Menace is offline   0 Reply With Quote
Old May 18, 2012, 04:48 AM   #16
Mr. Retrofire
macrumors 601
 
Mr. Retrofire's Avatar
 
Join Date: Mar 2010
Location: www.emiliana.cl
Quote:
Originally Posted by Red Menace View Post
As mentioned, you will need QuickTime Player 7 with the Pro registration (this is not the same application as the default QuickTime Player).
Link:
QuickTime Player 7 is available on your Installation DVD (Leopard/Snow Leopard) or via Apple (Lion/Mountain Lion):
Installing QuickTime Player 7 on Mac OS X v10.6 or Later
__________________

“Only the dead have seen the end of the war.”
-- Plato --
Mr. Retrofire is offline   0 Reply With Quote
Old May 18, 2012, 10:52 AM   #17
mishamazor
macrumors newbie
 
Join Date: Dec 2007
Quicktime 7 + Lion, still not working

Quote:
Originally Posted by Mr. Retrofire View Post
Link:
QuickTime Player 7 is available on your Installation DVD (Leopard/Snow Leopard) or via Apple (Lion/Mountain Lion):
Installing QuickTime Player 7 on Mac OS X v10.6 or Later
Yes, I have Quicktime 7 Pro installed under Lion. Still not working. When I drag my clips into the Apple Script Applet, nothing happens at all. Ideas?
mishamazor is offline   0 Reply With Quote
Old Dec 3, 2012, 04:55 PM   #18
jasone6
macrumors member
 
Join Date: Jan 2008
Quote:
Originally Posted by Peter Maurer View Post
Try saving this as an AppleScript application (i.e., a droplet):
This script concatenates separate movie files into one QuickTime movie...
This is really awesome… Thank you, Peter!

I was able to get it to work quickly… the only piece I'm still trying to figure out is what (if anything) can/should be done while saving the resulting file. e.g., the QT property inspector shows that the combined file still has many "pieces"—and I'm not sure if that matters or not.

Thanks again!
jasone6 is offline   0 Reply With Quote
Old Dec 4, 2012, 12:49 AM   #19
foidulus
macrumors 6502a
 
Join Date: Jan 2007
Quote:
Originally Posted by jasone6 View Post
This is really awesome… Thank you, Peter!

I was able to get it to work quickly… the only piece I'm still trying to figure out is what (if anything) can/should be done while saving the resulting file. e.g., the QT property inspector shows that the combined file still has many "pieces"—and I'm not sure if that matters or not.

Thanks again!
The movie is almost certainly a "reference" movie, (ie if you look at the file itself it's only probably a couple of k), it just points to a bunch of other movies. You have to do an export to get it into a format where it can be used on other machines.
foidulus is offline   0 Reply With Quote
Old Jan 14, 2013, 07:17 PM   #20
proboscisjoe
macrumors member
 
Join Date: May 2008
Would a shell script do the trick?

@dduke

If your individual frame files are named such that they can be sorted in the finder alphabetically/numerically, then you can probably use a shell script to run the ls command to list the contents of the folder (in order by file name) containing your files, then feed the result of that listing into the cat command to read and output the contents of the files, then direct the result of cat to be fed into a file with an extension matching the file type that you want.

For instance:

Code:
#!/bin/sh

cat $(ls /path/to/frames) > /path/to/complete/file/nameOfFile.mpg
...or something like that. It's not an actual program, but it should satisfy your interests.

I have only used such a command myself when the source file type matched the destination type.
proboscisjoe is offline   0 Reply With Quote
Old Jan 15, 2013, 01:52 AM   #21
ytk
macrumors regular
 
Join Date: Jul 2010
That... won't possibly work.
ytk is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
.AVI movies wont play on Quicktime fitworldmac Digital Video 4 Dec 18, 2013 07:45 AM
Quicktime Export Code woodaman09 Mac Programming 0 Sep 17, 2013 12:32 PM
Combining 2 Movies in Quicktime - audio issues Aragornii Mac Applications and Mac App Store 0 May 2, 2013 07:02 PM
QuickTime Code mortfe Mac OS X 10.7 Lion 13 Jan 20, 2013 01:31 AM
Partition Merge Problem (Can't Merge Empty Space) Zanon OS X 10.8 Mountain Lion 1 Sep 24, 2012 09:59 PM

Forum Jump

All times are GMT -5. The time now is 07:01 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC