Script to segment sermons

I am looking for a quicktime script to automatically segment sermons into 4 or 5 minute chunks. I have serveral sermons that are over 1 hour long and would like to break them up into more managable segments. Thanks in advance for your help. :smiley:

Are you looking for a script that will take an audio/video recorded file of a sermon and cut it into pieces, or what? What format are the sermons in? What kind of format & naming scheme are you expecting to output?

Before I can help, I need to know exactly what kind of inputs and outputs you are expecting from the script. I’d like to help, but your initial post leaves off many details.

Sorry I left out details.
The sermons are about 1 hour in length, they are in mp3 format. I am looking to segment the sermons into 4 or 5 minute chunks.
So the script would do the following:

  1. Take 60 minute sermon, seperate it into 4 or 5 minute segments,
  2. save the segments out to new mp3 files with a naming convention something like 01 sermon, 02 sermon, etc.

My ultimate goal is to burn these sermons onto CD so that I can listen to the sermon but not have to worry about listening to the whole thing over if I have to stop in the middle. I could then just skip close to where I left off.

I hope this helps.

Play around with the following:

tell application "QuickTime Player"
	activate
	
	try
		if not (exists movie 1) then error "No movies are open."
		
		stop every movie
		
		-- CHECK FOR THE CORRECT VERSION
		set QT_version to (QuickTime version as string)
		set player_version to (version as string)
		if (QT_version is less than "5.0") or ¬
			(player_version is less than "5.0") then
			error "This script requires QuickTime 5.0 or greater." & ¬
				return & return & ¬
				"Current QuickTime Version: " & QT_version & return & ¬
				"Current QuickTime Player Version: " & player_version
		end if
		
		-- CHECK FOR QUICKTIME PRO
		if QuickTime Pro installed is false then
			set the target_URL to "http://www.apple.com/quicktime/download/"
			display dialog "This script requires QuickTime Pro." & return & return & ¬
				"If this computer is currently connected to the Internet, " & ¬
				"click the "Upgrade" button to visit the QuickTime Website at:" & ¬
				return & return & target_URL buttons {"Upgrade", "Cancel"} default button 2
			ignoring application responses
				tell application "Finder"
					open location target_URL
				end tell
			end ignoring
			error number -128
		end if
		
		-- BEGIN CODE
		set the destination_folder to choose folder with prompt "Destination folder for the split files:"
		
		repeat
			display dialog "Split files to what length (in minutes)?" default answer "5"
			set split_length to the text returned of the result
			if split_length is not "" and split_length is not "0" then exit repeat
		end repeat
		
		set begin_movie to 0
		set end_movie to duration of movie 1
		set split_length to ((time scale of movie 1) * 60 * split_length) as integer
		set number_of_splits to end_movie / split_length as string
		if number_of_splits contains "." then
			set number_of_splits to (round number_of_splits rounding toward zero) + 1
		end if
		
		set the file_name to the name of movie 1
		
		repeat with i from 1 to number_of_splits
			set end_selection to (begin_movie + split_length)
			if end_selection is greater than end_movie then set end_selection to end_movie
			select movie 1 at begin_movie to end_selection
			cut movie 1
			make new movie
			paste movie 1
			with timeout of 300 seconds
				export movie 1 to file ((the destination_folder as text) & "Split_" & i & " " & the file_name) as QuickTime movie using default settings without replacing
			end timeout
			close movie 1 without saving
		end repeat
		
		close movie 1 saving no
		-- END CODE
		
		-- ERROR CODE	
	on error error_message number error_number
		if the error_number is not -128 then
			beep
			display dialog error_message buttons {"Cancel"} default button 1
		end if
	end try
end tell