News:

--

Main Menu

Exit Avidemux Jobs

Started by kafel666, August 19, 2019, 06:55:48 AM

Previous topic - Next topic

kafel666

Hi!

Is there any chance to implement "exit avidemux jobs", or better: "close system" when all jobs done in jobs window?
I use avidemux3_jobs_qt5 and this option will be very helpful.
Ubuntu 18.04 LTS x64, Avidemux 2.7.4

eumagga0x2a

AFAIK there is no unified, reliable way to enter sleep mode from a userspace application on Linux. Instead of using Jobs GUI, you could use Avidemux on command line directly and add a script capable of suspending (or shutting down) your Linux distribution once the last call has returned.

kafel666

I try this:
while pgrep &>/dev/null -f avidemux3_qt5; do sleep 10; done; shutdown -h 1
but it works only when I close jobs windows manually, same command with avidemux can't be done in many jobs to work, because it will shutdow system after first encoding: avidemux window starting to every job, and close, so if jobs window may option close itself after last job, it will be fine.

eumagga0x2a

pgrep -f expects the full command line, which is not just avidemux3_qt5. Just drop "-f" and eventually add

pkill avidemux3_jobs_qt5

kafel666

I tried without, or with '-f ', with option pkill, I tried to change order of options, but shutdown works immediately while running program, or only after I manually closed window jobs...
I can't force system to power off, when all avidemux jobs are done...
Of course it mean: set it before starting program.

eumagga0x2a

In doubt don't use the Job GUI at all, just script avidemux3_qt5 directly.

kafel666

Avidemux is great software, jobs works perfect, but when I convert many video and I leave computer on night, or just I go out, it will be very well to shotdown cpu after last job... so option in jobs: leave window after last done will allow to do it.

eumagga0x2a

There must be some mistake in the hacky workaround you use to kill Jobs GUI process.

I can only repeat my recommendation to call avidemux3_qt5 directly in your shell script. That Jobs GUI is helpful on Windows where scripting and command line usage was (it is getting better now, but starting from an abysmal level) an unbelievable pain. Just script avidemux3_qt5 if you need HW accel or avidemux3_cli directly. You would need the --nogui switch to auto-confirm dialogs. No need to kill anything, just shutdown the system when the last call returns.

kafel666

It doesn't matter how I run Avidemux Jobs, in terminal, with --nogui too: evrytime start window with jobs, and I can only start encoding manually, and after all window not close.

eumagga0x2a

My bad, I've missed the note at the bottom of the pkill manpage stating that without -f the pattern may be maximum 15 characters long. So you were right, to kill Job GUI, add either

pkill -f avidemux3_jobs_qt5

or

pkill avidemux3_jobs_

(max. 15 characters!) to the script. If you really insist on using the Jobs GUI instead of saving project files to a folder and writing a shell script to run

avidemux3_qt5 --run Path/to/yourScriptFile.py --save Path/to/outputFile --quit

for each, of couse. No need to check in short intervals whether a process is still running (with a bit of bad luck pgrep can catch a brief moment when one job is done and the next one not yet started).

kafel666

#10
OK, now after setting video to convert in avidemux I only save script project for each video, but not adding to queue, and when is time to convert I do:

avidemux3_qt5 --run /home/xxx/.avidemux6/jobs/a.py --save /media/xxx/R/Done/a.mp4 --quit && avidemux3_qt5 --run /home/xxx/.avidemux6/jobs/b.py --save /media/xxx/R/Done/b.mp4 --quit && avidemux3_qt5 --run /home/xxx/.avidemux6/jobs/c.py --save /media/xxx/R/Done/c.mp4 --quit && shutdown -h 2

everything works!

but I have a question: while adding to queue videos to convert with avidemux jobs later it remember output patch & file name, but there's not in script file: if it is created from menu script, or add to queue...? so it is necessary to input in command.

eumagga0x2a

Quote from: kafel666 on August 27, 2019, 05:00:58 PM
while adding to queue videos to convert with avidemux jobs later it remember output patch & file name, but there's not in script file: if it is created from menu script, or add to queue...? so it is necessary to input in command.

The output file name incl. the full path is stored in a SQLite3 database when adding a job to queue. It is then retrieved by Jobs GUI from this database while constructing the command line for the avidemux executable to run a job.

I.e. the project files are automatically saved to the ~/.avidemux6/jobs/ directory (and never deleted), the argument for --save lands in ~/.avidemux6/jobs.sql.

kafel666

Thank you very much for your help: now after converting videos my pc is power off and it's very usefull for me!
It's my first step in linux, my english is poor so thank's for indulgence :)