Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th June 2021, 08:34   #1  |  Link
Transferred
Registered User
 
Join Date: Aug 2020
Posts: 3
Only a simgle instance of ffmpeg

Dear Doom9ers,
Is possible to force only a single instance of ffmpeg to run on windows 10?

I have a *.bat, (with a For command), which checks a folder every several minutes and if it finds a new file encodes it. But if this has not finished and a new file appears, start a new instance of ffmpeg.
I need it to wait until it encodes all the files.

Thanks for your help.
Attached Files
File Type: txt Check_png.bat.txt (377 Bytes, 91 views)

Last edited by Transferred; 11th June 2021 at 10:50.
Transferred is offline   Reply With Quote
Old 11th June 2021, 10:12   #2  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 11th June 2021, 11:21   #3  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Actually I think the "ffmpeg" invocation inside of your for loop should be "blocking" (wait for completion). In a batch file, you'd have to prefix "start ..." to the command in order to get a non-blocking invocation.

So, this batch file (alone) should never launch more than one "ffmpeg" instance at the same time. But how do you invoke the batch file "every several minutes"?

I suspect that the batch file, as a whole, gets invoked again, before the previous instance has finished. Hence you would have multiple instances of the batch file running at the same time – and thus also multiple instances of ffmpeg.

[EDIT]

Instead of invoking the batch file every N minutes, you could just keep a single instance of the batch file running "forever". For example, add goto:loop just after the end of the for loop and put label :loop just before the loop.

You may use timeout command to add some delay after each for loop, in order to not waste too much CPU time in busy waiting. Or, even better, or use my notifywait tool to monitor file changes
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 11th June 2021 at 19:00. Reason: Updated URL
LoRd_MuldeR is offline   Reply With Quote
Old 11th June 2021, 18:54   #4  |  Link
Transferred
Registered User
 
Join Date: Aug 2020
Posts: 3
Thank you very much wonkey_monkey and LoRd_MuldeR,
You hit the target, I invoke the batch file with the windows task scheduler every 5 minutes.
I'll use the goto:loop and sleep to add a delay.
I will also test your notification tool to monitor.
Thank you very much, a pleasure to be a member of the forum.
Transferred is offline   Reply With Quote
Old 18th June 2021, 07:35   #5  |  Link
Transferred
Registered User
 
Join Date: Aug 2020
Posts: 3
Regards, So it was solved
Attached Files
File Type: txt Check_png.bat.txt (508 Bytes, 95 views)
Transferred is offline   Reply With Quote
Reply

Tags
ffmpeg

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:14.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.