0

What I try to achieve:

Expanding my Nautilus context menu by an action to simply select a JPG-file and a MP3-file to combine them to a MP4-file like I already do in terminal by this command:

ffmpeg -r 1 -loop 1 -i image.jpg -i audio.mp3 -acodec copy -r 1 -shortest -vf scale=1920:1080 video.mp4

––––––––––––––––––––––––––

This is what I've done:

I created a file composite_video.sh and saved it in /opt/lampp/htdocs/git/nautilus-scripts (to sync it with my GitHub, too)

#!/bin/bash
if [ "$#" -ne 2 ]; then
    echo "Call the script with ./$(basename "$0") (path to image) (path to video)"
else
    ffmpeg -r 1 -loop 1 -i "$1" -i "$2" -acodec copy -r 1 -shortest -vf scale=1920:1080 video.mp4
fi

Then I created a new FileManager-Action like this: enter image description here

––––––––––––––––––––––––––

This don't work. If I select JPG and MP3 and select action in Nautilus context menu nothing happens. What did I wrong?

1 Answer 1

0

For one... You don't have parameters passing. You aren't giving it any files to process.

I am using ubuntu 20.04 in Flashback... so there could be some other differences you may have to look into... But it works for me.

just for notes... In addition to filemanager-actions, I also installed nautilus-actions and nautilus-extension-fma since I am using nautilus... I don't know what effect this had because I believed it wasn't working for me at first.

I didn't notice it working at all until I did nautilus -q

Then when I did, I found I had to run nautilus, either from the terminal or under the Execution tab select "Display Output" so I could watch the logs to see why it was not executing... running a continuous tail on /var/log/syslog in a separate terminal also provided the same output.

The main problem after figuring out I had to (well first, right click on the icon) use the %F parameter type on the command tab (%F=file list...or %U=uri list), was that it read the list of parameters in alphabetical order... haven't figured out the "proper" fix for that yet. So the workaround, I had to rename the song so that it got read last.... as you can see in the picture.

enter image description here

1
  • If I am judging your picture correctly, the not-reading parameters may be the main problem... but if the it is failing because it is reading the song first, like it was for me, then you may have to rewrite your script to do a check for which parameter is the image...
    – WU-TANG
    Aug 23, 2020 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.