Fwd: [racket-users] GUI for ffmpeg and mrlib/terminal

2017-08-31 Thread James
This too.  I meant this to go to the list.

Begin forwarded message:

> From: James <jbiomant...@gmail.com>
> Date: August 30, 2017 4:29:39 PM EDT
> To: William G Hatch <will...@hatch.uno>
> Subject: Re: [racket-users] GUI for ffmpeg and mrlib/terminal
> 
> 
> On Aug 30, 2017, at 12:24 PM, William G Hatch wrote:
> 
>> On Wed, Aug 30, 2017 at 09:57:01AM -0400, David Storrs wrote:
>>> Still, I'm also interested in the original question:  if I wanted an
>>> interactive GUI terminal in Racket, what's the best way to do it?
>> 
>> Another thing you can look at is my Rackterm package[1].  It is currently an 
>> undocumented mess (and the first Racket project I made over a couple hundred 
>> lines), but it is also a reasonably compliant xterm that handles 
>> colors/styles, curses applications (eg. emacs and vim work fine in it), etc. 
>>  I've always intended to clean up the parser and make it available as a 
>> library for applications that want to parse and use input with ANSI control 
>> characters in it, make the various pieces available as stable interfaces for 
>> embedding terminals into applications, etc.  I haven't gotten around to 
>> doing that, but there is an unstable terminal-canvas.rkt that provides the 
>> terminal gui widget.
>> 
>> [1] https://github.com/willghatch/rackterm
> 
> This sounds good.  Besides ffmpeg, there are many other situations where it 
> would be good to have a combination of a GUI and interactive terminal.  In 
> the past, I have created quite a few AppleScript droplets which you drag 
> files onto and it loops through them, running a command on each one in a 
> Terminal window.  Sometimes, it's useful to hit the up arrow in Terminal 
> after a command is done, edit and rerun it, as a one-off thing, rather than 
> having to edit the AppleScript.  
> 
> Ffmpeg gives both warnings and error messages.  MrLib Terminal just displays 
> all text in red.  In the macOS Terminal, ffmpeg highlights different warnings 
> and errors in different colors.  One error that I am running into, since I am 
> testing repeatedly, is "Output file already exists.  Overwrite? y/N."  At 
> that point, there is no way to respond and i just have to cancel and try 
> again.  I suppose that I can catch that specific situation in my Racket code 
> and handle it but it would still be nice to be able to respond to other 
> unanticipated prompts.
> 
> James  

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] GUI for ffmpeg and mrlib/terminal

2017-08-30 Thread James

On Aug 30, 2017, at 10:23 AM, Neil Van Dyke wrote:

> 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.

Right.  It would be good to handle error messages but there are also warnings 
and prompts.  For example, if the output file already exists, it asks whether 
you want to overwrite.  Warnings should be shown prominently but not reacted 
to.  

Currently, I am using the cleanup-thunk from MrLib Terminal to notify the user 
when the process is done but a progress bar would be much nicer.  Ffmpeg has a 
--progress parameter which sends progress information to a url. That may be 
useful.  

James

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] GUI for ffmpeg and mrlib/terminal

2017-08-30 Thread Leif Andersen
(Although to be clear, slideshow-repl will show you how you can set up
a repl rather than a terminal. But I suspect they will be similar in
the gui-building respect.)

~Leif Andersen


On Wed, Aug 30, 2017 at 2:00 PM, Leif Andersen  wrote:
>> Another thing you can look at is my Rackterm package[1].
>
> Wow, that's nifty. :)
>
>> Still, I'm also interested in the original question:  if I wanted an 
>> interactive GUI terminal in Racket, what's the best way to do it?
>
> Fair. Will's RacketTerm project looks like a good resource. Another
> resource I think is very helpful is Matthew's `slideshow/repl`
> package: https://github.com/mflatt/slideshow-repl
>
> Specifically, it shows you how you can make a repl text in an editor%
> in a frame%. Specifically, I would recommend checking out:
>
> `slideshow/private/editor.rkt` in that repo. The two classes
> slide:text% and repl-text% (lines 58-368) should show you how to get
> started.
>
> The mrlib/terminal library is cool, but it hasn't been touched for 5
> or so years.
>
> ~Leif Andersen
>
>
> On Wed, Aug 30, 2017 at 12:24 PM, William G Hatch  wrote:
>> On Wed, Aug 30, 2017 at 09:57:01AM -0400, David Storrs wrote:
>>>
>>> Still, I'm also interested in the original question:  if I wanted an
>>> interactive GUI terminal in Racket, what's the best way to do it?
>>
>>
>> Another thing you can look at is my Rackterm package[1].  It is currently an
>> undocumented mess (and the first Racket project I made over a couple hundred
>> lines), but it is also a reasonably compliant xterm that handles
>> colors/styles, curses applications (eg. emacs and vim work fine in it), etc.
>> I've always intended to clean up the parser and make it available as a
>> library for applications that want to parse and use input with ANSI control
>> characters in it, make the various pieces available as stable interfaces for
>> embedding terminals into applications, etc.  I haven't gotten around to
>> doing that, but there is an unstable terminal-canvas.rkt that provides the
>> terminal gui widget.
>>
>> [1] https://github.com/willghatch/rackterm
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] GUI for ffmpeg and mrlib/terminal

2017-08-30 Thread Leif Andersen
> Another thing you can look at is my Rackterm package[1].

Wow, that's nifty. :)

> Still, I'm also interested in the original question:  if I wanted an 
> interactive GUI terminal in Racket, what's the best way to do it?

Fair. Will's RacketTerm project looks like a good resource. Another
resource I think is very helpful is Matthew's `slideshow/repl`
package: https://github.com/mflatt/slideshow-repl

Specifically, it shows you how you can make a repl text in an editor%
in a frame%. Specifically, I would recommend checking out:

`slideshow/private/editor.rkt` in that repo. The two classes
slide:text% and repl-text% (lines 58-368) should show you how to get
started.

The mrlib/terminal library is cool, but it hasn't been touched for 5
or so years.

~Leif Andersen


On Wed, Aug 30, 2017 at 12:24 PM, William G Hatch  wrote:
> On Wed, Aug 30, 2017 at 09:57:01AM -0400, David Storrs wrote:
>>
>> Still, I'm also interested in the original question:  if I wanted an
>> interactive GUI terminal in Racket, what's the best way to do it?
>
>
> Another thing you can look at is my Rackterm package[1].  It is currently an
> undocumented mess (and the first Racket project I made over a couple hundred
> lines), but it is also a reasonably compliant xterm that handles
> colors/styles, curses applications (eg. emacs and vim work fine in it), etc.
> I've always intended to clean up the parser and make it available as a
> library for applications that want to parse and use input with ANSI control
> characters in it, make the various pieces available as stable interfaces for
> embedding terminals into applications, etc.  I haven't gotten around to
> doing that, but there is an unstable terminal-canvas.rkt that provides the
> terminal gui widget.
>
> [1] https://github.com/willghatch/rackterm
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] GUI for ffmpeg and mrlib/terminal

2017-08-30 Thread William G Hatch

On Wed, Aug 30, 2017 at 09:57:01AM -0400, David Storrs wrote:

Still, I'm also interested in the original question:  if I wanted an
interactive GUI terminal in Racket, what's the best way to do it?


Another thing you can look at is my Rackterm package[1].  It is currently an 
undocumented mess (and the first Racket project I made over a couple hundred 
lines), but it is also a reasonably compliant xterm that handles colors/styles, 
curses applications (eg. emacs and vim work fine in it), etc.  I've always 
intended to clean up the parser and make it available as a library for 
applications that want to parse and use input with ANSI control characters in 
it, make the various pieces available as stable interfaces for embedding 
terminals into applications, etc.  I haven't gotten around to doing that, but 
there is an unstable terminal-canvas.rkt that provides the terminal gui widget.

[1] https://github.com/willghatch/rackterm

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] GUI for ffmpeg and mrlib/terminal

2017-08-30 Thread Neil Van Dyke

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.


--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] GUI for ffmpeg and mrlib/terminal

2017-08-30 Thread David Storrs
That is very cool, Leif.

Still, I'm also interested in the original question:  if I wanted an
interactive GUI terminal in Racket, what's the best way to do it?

On Tue, Aug 29, 2017 at 7:40 PM, Leif Andersen 
wrote:

> Well James, you're in luck.
>
> The short answer is, yes, yes you can.  You should check out video at
> http://lang.video (you can follow the progress either on the blog, the
> twitter feed http://twitter.com/videolang , or on github itself:
> https://github.com/videolang/video . Alternatively, you are welcome to
> arrange a call with me some time so we can coordinate our efforts.
>
>
> The (slightly) longer answer is: you can find the (private and thus
> unstable) bindings here:
> https://github.com/videolang/video/tree/master/video/private/ffmpeg;
> and my (very early) prototype NLVE widgets here:
> https://github.com/videolang/video/blob/master/video/private/editor.rkt.
> In either case, contributions are absolutely welcome. Bug reports are
> also welcome and very helpful.
>
> I hope that helps, and feel free to ask any questions. If you are
> interested in creating GUIs for Video editing we should also sit down
> for a chat some time. (Either in person or via teleconference.)
>
> Anyway, I hope you have a lovely day.
>
> ~Leif Andersen
>
>
> On Tue, Aug 29, 2017 at 3:57 PM, James  wrote:
> > 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.  MrLib/terminal seems like just
> the thing except there are various ways that it isn't as good as it could
> be for this kind of project.   It's mostly small things, for example, the
> cancel button is labeled "Abort Instillation" by default.  The one thing
> which is not so simple is that it looks like it is intended to just run one
> command and not create an interactive environment.  I was expecting to be
> able to send commands to the terminal% object in order to run things one
> after another.  Instead, you pass a function as a parameter when you create
> the terminal% object and it just runs that function.  So, either I have to
> close the terminal and open a new one each time I run a command or I
> suppose that I could have the function work with a thread mailbox or
> channels so that I could keep using it.  My question is whether MrLib
> Terminal the best option for this kind of work or is there a better bet?
> >
> > https://docs.racket-lang.org/mrlib/Terminal_Window.html
> >
> > James
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] GUI for ffmpeg and mrlib/terminal

2017-08-29 Thread Leif Andersen
Well James, you're in luck.

The short answer is, yes, yes you can.  You should check out video at
http://lang.video (you can follow the progress either on the blog, the
twitter feed http://twitter.com/videolang , or on github itself:
https://github.com/videolang/video . Alternatively, you are welcome to
arrange a call with me some time so we can coordinate our efforts.


The (slightly) longer answer is: you can find the (private and thus
unstable) bindings here:
https://github.com/videolang/video/tree/master/video/private/ffmpeg;
and my (very early) prototype NLVE widgets here:
https://github.com/videolang/video/blob/master/video/private/editor.rkt.
In either case, contributions are absolutely welcome. Bug reports are
also welcome and very helpful.

I hope that helps, and feel free to ask any questions. If you are
interested in creating GUIs for Video editing we should also sit down
for a chat some time. (Either in person or via teleconference.)

Anyway, I hope you have a lovely day.

~Leif Andersen


On Tue, Aug 29, 2017 at 3:57 PM, James  wrote:
> 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.  MrLib/terminal seems like just 
> the thing except there are various ways that it isn't as good as it could be 
> for this kind of project.   It's mostly small things, for example, the cancel 
> button is labeled "Abort Instillation" by default.  The one thing which is 
> not so simple is that it looks like it is intended to just run one command 
> and not create an interactive environment.  I was expecting to be able to 
> send commands to the terminal% object in order to run things one after 
> another.  Instead, you pass a function as a parameter when you create the 
> terminal% object and it just runs that function.  So, either I have to close 
> the terminal and open a new one each time I run a command or I suppose that I 
> could have the function work with a thread mailbox or channels so that I 
> could keep using it.  My question is whether MrLib Terminal the best option 
> for this kind of work or is there a better bet?
>
> https://docs.racket-lang.org/mrlib/Terminal_Window.html
>
> James
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] GUI for ffmpeg and mrlib/terminal

2017-08-29 Thread James
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.  MrLib/terminal seems like just the 
thing except there are various ways that it isn't as good as it could be for 
this kind of project.   It's mostly small things, for example, the cancel 
button is labeled "Abort Instillation" by default.  The one thing which is not 
so simple is that it looks like it is intended to just run one command and not 
create an interactive environment.  I was expecting to be able to send commands 
to the terminal% object in order to run things one after another.  Instead, you 
pass a function as a parameter when you create the terminal% object and it just 
runs that function.  So, either I have to close the terminal and open a new one 
each time I run a command or I suppose that I could have the function work with 
a thread mailbox or channels so that I could keep using it.  My question is 
whether MrLib Terminal the best option for this kind of work or is there a 
better bet?

https://docs.racket-lang.org/mrlib/Terminal_Window.html

James

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.