Skip to content

Quick-Access FFMPEG operations directly in Ubuntu Desktop GUI Context Menu

Notifications You must be signed in to change notification settings

tanjary21/Flash_FFMPEG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Flash FFMPEG

Quick-Access FFMPEG operations directly in the Context Menu on Ubuntu's Desktop GUI

A convenient, user-friendly command set to run ffmpeg commands from the right-click menu.

Tested on:

  • Ubuntu 20.04.1

Sections:

  • Backstory
  • Installation
  • Usage Examples
  • Custom Functionality
  • Uninstallation
  • Future

Backstory

The project started out during my MSc. studies. I found myself having to frequently convert my data/results into visualizations in nice video formats, or .gifs to save on memory. And using ffmpeg through the terminal just wasn't becoming a reflex fast enough. Frequent errors, incompatible resolution specs, frame rates etc used to slow me down for stuff that really wasn't supposed to take more than 2 seconds. And so, like any decent engineer, I automated my work flows to save on a resource that's very precious in grad school; time.

At the time, these were mostly simple BASH scripts put into my .bashrc. Since then, I've figured out how to put them into Ubuntu's Desktop UI's context menu. I'm now making this available to all as a .deb package that Ubuntu users can install.

This also serves me as a way to learn debian packaging.


Installation

Step 1

  • Download the latest release for your system, e.g: flash-ffmpeg_0.1-0_amd64.deb file (see panel on the right of this repo)
  • From your terminal, run the command sudo dpkg -i flash-ffmpeg_0.1-0_amd64.deb
  • IMPORTANT: Run the command nautilus -q to restart the file explorer
  • You are ready to use Flash FFMPEG from your right-click menu!

Usage Examples

MP4 File to GIF:

mp4_to_gif.webm.mov

Extract Frames from MP4:

mp4_to_frames.webm.mov

Compile Frames to MP4:

frames_to_mp4.webm.mov

Downsample MP4

downsample_mp4.webm.mov

Batch Processing:

batch_mp4_to_gif.webm.mov

Adding Custom Functionality

When you right-click on a file(s)/directory(s), the path(s) to those file(s)/directory(s) become the input arguments to the context menu operations. The context menu operations themselves are simply symlinks stored under $HOME/.local/share/nautilus/scripts which link to .sh scripts that contain the main functionality.

Let's explain this better by explaining how you can create your own custom script. The script mp4_vertcal_splitter.sh slices a .mp4 file into 2, vertically split .mp4 files.

Download the file mp4_vertcal_splitter.sh file. This script can take any number of video files as input. You can run it via the terminal with ./mp4_vertical_splitter.sh video_1.mp4 video_2.mp4 video_3.mp4 ... ( make sure the script has execution permissions ). The script then launches a pop-up window using the yad package, asking you to specify how many vertical sections you want to split your videos into (default of 2). It then runs and writes the sliced video output into individual directories under the selected files' directory.

Use this file as a guide to write your own custom BASH scripts.

Next, place your custom script under /usr/share/flash_ffmpeg/scripts/custom_scripts/. This is where we will store source code for all our scripts.

Next, create a symlink under $HOME/.local/share/nautilus/scripts/'Flash FFMPEG'/'Custom Scripts'/'Name your custom script' that links to /usr/share/flash_ffmpeg/scripts/custom_scripts/<your_custom_script>.sh. Make sure the symlinks and the .sh scripts are executable.

Restart nautilus with the command nautilus -q ( or restart your PC, if it doesn't work).

Now, when you right-click on a file, you will see your custom command appear in the context-menu under Scripts --> Flash FFMPEG --> Custom Scripts.

And that's it!


Uninstallation

  • Simply run the command sudo dpkg -r flash-ffmpeg from your terminal
  • If the uninstall does not run flawlessly, run the following commands:
sudo mv /var/lib/dpkg/info/flash-ffmpeg.* /tmp/
sudo dpkg --remove --force-remove-reinstreq flash-ffmpeg
sudo dpkg --purge flash-ffmpeg
  • Then, run dpkg -l | grep flash-ffmpeg. If nothing is returned, it means Flash FFMPEG was properly removed from your system

Future

  • Progress bars
  • Icons/thumbnails
  • Automatic video snipping/stitching in sync with an input audio's salient beat/bpm