Author Topic: Exit Avidemux Jobs  (Read 827 times)

kafel666

  • Newbie
  • *
  • Posts: 7
Exit Avidemux Jobs
« on: August 19, 2019, 06:55:48 AM »
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

  • Moderator
  • Hero Member
  • *****
  • Posts: 3400
Re: Exit Avidemux Jobs
« Reply #1 on: August 19, 2019, 07:03:22 AM »
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

  • Newbie
  • *
  • Posts: 7
Re: Exit Avidemux Jobs
« Reply #2 on: August 19, 2019, 07:46:02 PM »
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

  • Moderator
  • Hero Member
  • *****
  • Posts: 3400
Re: Exit Avidemux Jobs
« Reply #3 on: August 19, 2019, 08:09:12 PM »
pgrep -f expects the full command line, which is not just avidemux3_qt5. Just drop "-f" and eventually add

pkill avidemux3_jobs_qt5

kafel666

  • Newbie
  • *
  • Posts: 7
Re: Exit Avidemux Jobs
« Reply #4 on: August 22, 2019, 06:57:56 PM »
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

  • Moderator
  • Hero Member
  • *****
  • Posts: 3400
Re: Exit Avidemux Jobs
« Reply #5 on: August 22, 2019, 07:10:11 PM »
In doubt don't use the Job GUI at all, just script avidemux3_qt5 directly.

kafel666

  • Newbie
  • *
  • Posts: 7
Re: Exit Avidemux Jobs
« Reply #6 on: August 24, 2019, 10:39:11 AM »
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

  • Moderator
  • Hero Member
  • *****
  • Posts: 3400
Re: Exit Avidemux Jobs
« Reply #7 on: August 24, 2019, 11:47:22 AM »
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

  • Newbie
  • *
  • Posts: 7
Re: Exit Avidemux Jobs
« Reply #8 on: August 24, 2019, 07:35:58 PM »
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

  • Moderator
  • Hero Member
  • *****
  • Posts: 3400
Re: Exit Avidemux Jobs
« Reply #9 on: August 24, 2019, 10:19:08 PM »
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

Code: [Select]
pkill -f avidemux3_jobs_qt5
or

Code: [Select]
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

Code: [Select]
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

  • Newbie
  • *
  • Posts: 7
Re: Exit Avidemux Jobs
« Reply #10 on: August 27, 2019, 05:00:58 PM »
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.
« Last Edit: August 27, 2019, 05:16:00 PM by kafel666 »

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 3400
Re: Exit Avidemux Jobs
« Reply #11 on: August 27, 2019, 06:50:36 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

  • Newbie
  • *
  • Posts: 7
Re: Exit Avidemux Jobs
« Reply #12 on: August 28, 2019, 02:54:39 AM »
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 :)