ffmpeg watchfolder?

Status
Not open for further replies.

mysticmerlin

Cadet
Joined
Jan 26, 2018
Messages
8
I was wondering if it might be possible to monitor a folder for changes and apply an ffmpeg script to any new file? I need to frequently encode videos to DNx to be able to use them and it's inconvenient to do it on the client end.
Thanks
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
make a jail
install ffmpeg
write a script that looks for files in the folder and processes them as required
put that script in cron

I'd suggest that the script include protections on running multiple instances or processing the same file multiple times.
 

mysticmerlin

Cadet
Joined
Jan 26, 2018
Messages
8
Thanks , it's the third line that has me scratching my head. I could create a log and see if there any new files that need processing. Batch process them , wait until done and log them in. Or I could just check each file to see if it has a corresponding Dnx version and process it if not.
I could also play around with inotify. Multiple instances could be useful but I need to set cpu limits. I'll get back once I've found a working solution
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
I'd go with checking if each file has a corresponding version. You'll still need to protect against multiple invocations, otherwise your system will start slowing down each time cron kicks off a new instance of the script. You could handle that by reducing the run period, but then you have to wait longer for the videos to be processed. And a large conversion could still lead to multiple processes.
 
Status
Not open for further replies.
Top