Page 1 of 1
		
			
				Use ffmpeg to concatenate video files
				
Posted: 
Fri Jun 30, 2017 9:17 amby L2L
				I was able to get a little further, please see third post down with an updated question.
			 
			
		
			
				Re: Use ffmpeg to concatenate video files
				
Posted: 
Fri Jun 30, 2017 10:26 amby Mr_Noodle
				Have you tested this outside of Hazel?
Also, when you get rid of the hard-coding, how do you determine which other files to concatenate with the file the rule matches?
			 
			
		
			
				Re: Use ffmpeg to concatenate video files
				
Posted: 
Thu Jul 06, 2017 2:03 pmby L2L
				Here's an update to my original post.  I was able to get Hazel to concat using hard coded values and ffmpeg "concat protocol".
- Code: Select all
- ffmpeg -i concat:"video1.avi|video2.avi" -c copy output.avi
I'm trying to get it to work with variables but I get an error when the script runs saying it can't process the second file.  No video output occurs.
- Code: Select all
- filename=$(basename "$1")
 filename=${filename%.*}
 converting_filenameHD="$filename-output.mpg"
 
 ffmpeg -i concat:"$1" -c copy "converting_filenameHD"
Any idea how I can get the variables to work inside my script?
 
			
		
			
				Re: Use ffmpeg to concatenate video files
				
Posted: 
Fri Jul 07, 2017 12:08 pmby Mr_Noodle
				This is part of the question I asked earlier. You have one file. How do you determine the other files to concat with it. How are they related to the first file?
			 
			
		
			
				Re: Use ffmpeg to concatenate video files
				
Posted: 
Fri Jul 07, 2017 12:15 pmby L2L
				Mr_Noodle wrote:This is part of the question I asked earlier. You have one file. How do you determine the other files to concat with it. How are they related to the first file?
Sorry I didn't understand what you meant. The files are in the same folder. In the hardcoded version uses pipes to loop through files. That's where I'm stuck. I don't know how to loop through the files in the watch folder.
 
			
		
			
				Re: Use ffmpeg to concatenate video files
				
Posted: 
Mon Jul 10, 2017 10:59 amby Mr_Noodle
				That's outside of the support I can give. You'll need to look up how to do that with shell scripting. You'll probably need to do a loop where you construct that argument by concat'ing the file names together.
Also, you shouldn't assume the cwd. Either use full paths or do a "cd" at the beginning of the script.