James wrote on 08/29/2017 03:57 PM:
> I have been working through The Racket Graphical Interface Toolkit documentation to learn GUI programming and I thought I would do a small but useful project. The idea is to make a simple GUI front end which will formulate commands for ffmpeg to do various video and audio conversions on selected files and then run those commands.
James, this is a great idea GUI learning exercise (and coincidentally I
did a very similar thing for one of my first GUI programs, for a
different technical command line program with lots of complicated
options). I think you should do this.
Considering that "ffmpeg" is normally non-interactive, you don't
necessarily need full terminal functionality. You just need something
like Racket `subprocess` or `process*/ports`, and to write I/O-ish code
to monitor the stdout and stderr output, and do appropriate GUI things.
Specifically, you might want to do a few things with the stdout/stderr
output:
* Store some raw form of it (space-limited, like ring buffer), in case
user selects to show this in a GUI text viewer, or display it as ffmpeg
runs.
* Monitor it for error messages (you can use regexps), and present them
in a GUI-friendly way.
* Monitor it for progress information, and turn that into a GUI progress
bar or similar, since ffmpeg can take minutes or hours to run.
There's also some UI design challenges here. At first, you might want
to translate a bunch of command line arguments into GUI elements. After
doing some of it manually, you might also look at making it data-driven
(e.g., you come up with a minilanguage representing pertinent semantics
of the ffmpeg command line options, and then write code that translates
that to appropriate GUI elements. Before/after that you might want to
look at things like saving configurations (minilanguage helps here), and
providing higher-level "task" interfaces. (Say, a task is to convert
various video file formats to 1080/60p in a particular container and
codec profile, preserving aspect ratio. And maybe you can figure out
how to remove letterboxing black bars automatically from the original
videos.)
I threw out a few ideas for where you might take this, for later
reference, but the thing to do is to just sit down in front of a
DrRacket, and start building up code to handle the process and/or create
the GUI elements. At some point, you can come back to people's comments
and decide where you want to go next.