Command Line Video Processing Using FOSS


[Daniel Paluska] is getting away from the point-and-click by editing videos from the command line. Using the free open source software packages FFmpeg, Imagemagick, and Sox he produces new clips from multiple videos with effects like overlaying, slicing, and assigning each video to a different quadrant. The last option would be useful for displaying different angled shots of the same thing all at once but we’re sure you can find a way to use them all. He is using shell scripts to automate some of the process but the commands are still easy enough to understand if this is your first foray into these tools. After all, great video production will go a long way toward becoming an Internet sensation.

31 thoughts on “Command Line Video Processing Using FOSS

  1. Great video and demo!
    ffmpeg is really powerful & bash is the bomb for scripting, but it can be hard figuring out all the switches. I did something similar to stream & transcode podcasts for my mobile phone & it took quite a while to configure everything.

  2. @osgeld: trolling much?

    I’ve built my DVD creation script some weeks ago, and now I can simply put a blank DVD in the drive and write “makedvd MOVIE_NAME”.
    It gets the name, cover and filename from a GCstar database, uses imagemagick to make a background from the cover and movie name, converts it to mpeg with mjpegtools, than converts the file to mpeg2 with ffmpeg, and finally creates the DVD structure with dvdauthor, and burns it to disc with wodim :)

  3. and yes i use nix on a daily basis, but if you had bothered to read before opening your flap you would have known i was asking about the smartass trolling comment 1 POST ABOVE MINE

    every fkin read?

  4. I grew up with command line, I avoid it like Richard avoids getting that pine cone out of his arse

    Unfortunately, I fear eventually, the “i hate this crap I just want it to work” attitude I have been having as of recently will eventually lead me to buy a mac

  5. @Richard Nibbler:

    Command line isn’t dead. I use it on a daily basis. Not for things like video editing of course…but then, I don’t really do video editing in the first place. But why _anyone_ would want to click 20-30 times on a GUI when they could just punch in something like ‘sh’ or ‘pacman -S wine’ is beyond me….

  6. I knew of this musician named Doormouse who made Hardcore music (Electronic, not punk hardcore, that is.) He actually gained a good amount of notoriety in that scene. Anyway, he used to make his music on Windows 98’s built in sound recorder and the results were pretty incredible. This might be even more badass, but both are a little masochistic too, I think.

  7. @ Urza9814, I am sure ice is a big boy and your self involvement makes you no better than nibbler or any other troll around here

    welcome to the party, now stfu your not OUR mom

  8. I don’t get how someone claims to be right about CLI being dead on a post that shows CLI is alive and well. I know one thing’s for sure, I rarely miss GUI when ssh’ing into my headless Linux server, but I often need to open up a command prompt when working in a Linux GUI env. They both have their place, but sometimes the CLI’s versatility can be surprising, as in this article. Plus there’s less for creativity in problem solving with the GUI.

  9. Note: this isn’t a non-linear editor (what’s invariably meant when using the phrase ‘video editing’), but a frameserver with some filters. Closer to AVIsynth than virtualdub.

    And do stop feeding the trolls. You’re all as bad as each other.

  10. I have found GStreamer to be incredibly useful for processing audio/video on the command line and in shell scripts. In the past I’ve used a combination of ffmpeg, imagemagick, netpbm, and mplayer/mencoder to do video processing and editing in a few shell scripts, but it’s so messy compared to doing the same thing with a Gst pipeline… for anyone that has wrestled with processing video and audio using redirections and piping yuv4mpeg or raw RGB frames between separate command line tools, I definitely recommend getting acquainted with GStreamer

  11. Avisynth is nice. It’s not commandline, but it’s scripted video processing via a frameserver. It allows you to do stuff like combining two videos into one, side by side, which things like avidemux apparently can’t do by default. Also scripting is great, since you can just swap the videos out and rerun the script.

  12. urza because my keyboard is in a tray under my desk and I don’t have to take my hand off the mouse. Also one-click macros. Everyone forgot about macros?

  13. Thanks for the hack, mack.

    Already used it in the past, using it today,
    and have to agree that this is worthy of being mentioned on hackaday.

    For many video productions, commandline tools are very very, yes very usefull.
    Furthermore, it’s not just for video editing, but see it more as batch processing sequences.
    And yes this is very handy.

    purposes: automated dtection like video(image) recognition in a bash script (robotics, animal-detection for doors),
    video and image conversion on websites (like most automated image functions in certain cms’s),
    and so on..

    (@Richard Nibbler,
    WTHeck?! Seriously? you’ve only played with KISS systems like final cut or what?!
    sorry, just couldn’t let that one go, no flame or harm ment )

  14. “But why _anyone_ would want to click 20-30 times on a GUI when they could just punch in something like ‘sh’ or ‘pacman -S wine’ is beyond me….”

    You don’t. You doubleclick the icon you’ve made just for that purpose, so you don’t have to bother.

    If you want to criticize an UI, at least learn to use it and understand why it does what it does. GUI is about lazyness, and if you find yourself needing some function over and over again, you make a shortcut so you don’t have to type it in or click through a list of menus every single time.

  15. @Einomies : GUI shortcuts don’t allow for adding arguments easily.

    For your icon to work on a batch job, you have to move all of the files into a specific location first, then move them to the final location after the processing is finished.
    If you forget to move all of the files you might even double process something, or combine 2 projects by accident.

    Alternatively, you can setup a very nice alias on the command line (or on windows use a batch file stored in a folder, with the folder listed in your %PATH%)

    That way you can type “alias file1 file2” from any folder in any location and have the aliased script run with no problem. Additionally, you can type “alias *” and have every file in the current folder processed at once, without having to copy all of the files into a specific directory.

    This also allows you to run the same aliased script on 2 separate projects in 2 separate locations without having to have 2 separate shortcuts.

    Bonus, you can use ssh/telnet/logmein/vnc/psexec/whatever to run an alias from anywhere, and monitor the progress without needing a ton of bandwidth.

    Bonus2, your desktop isn’t littered with 1000+ shortcuts for scripts.

    For me, both of the above are important. I work on a lot of very different projects, and i’m extremely lazy. I process about 3hours of audio a week, maintain +100 systems, +50 servers, handle burning update disks for several of our products, and edit video from time to time.

    If I had a shortcut setup for every one of these batch jobs, (or god forbid, no scripting at all) I wouldn’t have enough hours in a day to do all of this, and it would take ten minutes to find the icon for anything.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.