Use ffmpeg to concatenate video files

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Use ffmpeg to concatenate video files Fri Jun 30, 2017 9:17 am • by L2L
I was able to get a little further, please see third post down with an updated question.
Last edited by L2L on Thu Jul 06, 2017 2:03 pm, edited 2 times in total.
L2L
 
Posts: 6
Joined: Wed May 06, 2015 12:40 am

Re: Use ffmpeg to concatenate video files Fri Jun 30, 2017 10:26 am • by 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?
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Use ffmpeg to concatenate video files Thu Jul 06, 2017 2:03 pm • by 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?
L2L
 
Posts: 6
Joined: Wed May 06, 2015 12:40 am

Re: Use ffmpeg to concatenate video files Fri Jul 07, 2017 12:08 pm • by 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?
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Use ffmpeg to concatenate video files Fri Jul 07, 2017 12:15 pm • by 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.
L2L
 
Posts: 6
Joined: Wed May 06, 2015 12:40 am

Re: Use ffmpeg to concatenate video files Mon Jul 10, 2017 10:59 am • by 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.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support