jumpcutter
jumpcutter copied to clipboard
Added a GUI
Following a proposal in #3, I added a quick GUI for the program using Tkinter. But since the API isn't super easy to tag a GUI into, it throws the values from the text boxes into the program by calling it with subprocess
.
Here's what the GUI looks like on Windows 10:
The text boxes with grey text simply use a default string if the user doesn't enter any text, and the advanced options is a collapsible panel. These are widgets from my library, hence the new requirement (pkinter
). All the text boxes (apart from the file ones) have tooltips as well!
TODO:
- [ ] Video and/or audio preview (requires a video and/or audio widget -- I'll write these for
pkinter
) - [x] Make use of the TTK
Spinbox
and/orScale
widgets for numeric values (Spinbox
's would require a similar wrapper widget as theEntry
's have, shouldn't be hard) - [x] Support for YouTube videos (requires syncing with master)
Bugs:
- [x]
Entry
widgets are being passed instead of their values (what a blunder) - [x] The output selector uses
filedialog.askopenfile
, it should usefiledialog.asksaveasfile
Edit: I haven't actually tested this since I don't have a video on hand to try it with, but it should still work.
dam you put mine to shame
the next step is probs to make the api better so we can get some data from it to display the video
When i try to set a custom output name, it says that the path isnt found oof
Oh! I didn't realise someone else was working on a GUI, I'm sorry, @elff1493. I should have submitted an issue and said I was going to work on one... My bad. You can do the video part if you want? It might take some time and it'd require a decent knowledge of the Canvas
widget... If not, I can get a widget written up for my library and use it here.
@A-Random-Birb, it does? Was that error thrown through by the GUI or the program itself? Did you use the button to select a file?
TODO:
A video preview of the output, with a preview button next to the run button
@DeflatedPickle Instead of a preview button
, a checkbox
next to RUN will be more suitable and easier to implement and understand. What do you think?
@abhiTronix, I say a preview button as then it would only have to process the video once when the user clicks it. If it was a checkbox, it seems like it would have to update each time the user updated a value, which could cause a bit of lag depending on their settings. Or were you thinking of implementing it differently?
I made a lil' gui about 8 hours ago or so :P. Wouldn't be easilly mergable though because in the process I also rewrote parts of the actual jumpcutter code to allow for better ffmpeg integration, not having to have two python processes spinning up, etc.
Ah, and so I have bested as well, @Bottersnike. You even have a nice progress window for the progress!
If I were you, I'd put together two pull requests, one for the FFMPEG stuff and another for the GUI, then they can be resolved easily.
It looks really good! I made one too with Qt Designer, but yours look better.
Yeah, I took a look. Good work, @A0A3R2E6! It's a bit messy but I believe you can hammer out the kinks!
It's my first time contributing to a project like this and already there are 3 different things like my thing! I'm nervous yet hopeful. May the best UI win, I guess!
@abhiTronix, I say a preview button as then it would only have to process the video once when the user clicks it. If it was a checkbox, it seems like it would have to update each time the user updated a value, which could cause a bit of lag depending on their settings. Or were you thinking of implementing it differently?
@DeflatedPickle I was thinking to display preview video with checkbox enabled at the end when the processing part is done i.e. by clicking the RUN
button. This checkbox will be checked
[ON] by default. A user can disable this by simply clicking it again if he doesn't want to preview file or will be disabled[OFF] by default if the input is audio only.
[Edit] Also, @DeflatedPickle we can save the setting in the .cache
folder as a text file for convenience. 😉
Thanks @DeflatedPickle !! It'd be nice if we all could merge our UI's into one so we could help create somewhat of a decent app. At this point we are all part of a team.
@abhiTronix, but if they've already run it and saved it to a file, there's not much point in previewing it in the GUI? Usually, a preview would come before it was saved.
@A0A3R2E6, as nice as that would be, I don't think it'd be super smart. As it wouldn't be very easy to merge a Qt UI into a Tk one, and you and (and I think) @Bottersnike used Qt. But we could work on improving one of the designs together?
@DeflatedPickle Well, by merging I meant of combining efforts, but yes it's true that literally combining all of the UI's would not be easy. But It'd be nice to work with you and @Bottersnike on improving one of the designs. Sign me in anyday.
@A0A3R2E6, ah, alright. @Bottersnike's changes aren't open-source last I checked, so they might not be up to have them pulled. So it's between yours and mine... Would you be okay working on mine?
@DeflatedPickle Alright then, we will work on yours.
this is really nice
@DeflatedPickle When I try to use the GUI jumpcutter.py throws an error saying that silent speed has an invalid float
Thank you, @cthpw103! If you have any suggestions for changes or ideas, please leave them in a comment and I can add them to the to-do list.
@will9183, right... So I think I forgot to convert the values in the text boxes to the proper types... I'm kind of ashamed it got this far without testing, I mean, someone even packaged it up in an EXE without reporting this. Thanks for bringing it up, I'll commit a fix after din-dins.
@DeflatedPickle No problem. I was planning on updating my installer anyways so it all works out.
@will9183, actually, I don't know what I was thinking. The values should be passed in as strings and then argparse
casts them to the type they should be. So it might just be a problem with what you entered for the silent speed.
Also, I apologise. I didn't remember it was you who used this for the EXE. Sorry about that. :v
Oops, it is actually silent threshold that is having an issue. This is the actual error:
usage: jumpcutter.py [-h] [--input_file INPUT_FILE] [--url URL] [--output_file OUTPUT_FILE] [--silent_threshold SILENT_THRESHOLD] [--sounded_speed SOUNDED_SPEED] [--silent_speed SILENT_SPEED] [--frame_margin FRAME_MARGIN] [--sample_rate SAMPLE_RATE] [--frame_rate FRAME_RATE] [--frame_quality FRAME_QUALITY] jumpcutter.py: error: argument --silent_threshold: invalid float value: '.!toggledlabelframe.!frame2.!entrytext'
The default value is 0.03
@will9183, okay, I think I might have figured out where the bug is. I'm using my own widgets wrong, geez. I'm gonna commit what might be a fix in a bit.
Edit: Yeah, this is totally going to fix it. I don't know what I was thinking.
@DeflatedPickle Yup it fixed it. Thank you, I will update my EXE tonight.
Great, @will9183! Thank you for bringing it to my attention, I'm not sure it would have been fixed otherwise!
@DeflatedPickle And now there is another error. I don't know if it is the gui or not but I get this halfway through ffmpeg's stuff and this shows up:
Traceback (most recent call last): File "jumpcutter.py", line 158, in <module> wavfile.write(sFile,SAMPLE_RATE,audioChunk) File "C:\Users\will9\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\io\wavfile.py", line 359, in write bytes_per_second, block_align, bit_depth) struct.error: required argument is not an integer
Sorry for the inconvenience
@will9183, it seems to be due to FFMPEG not wanting a float value for the sample rate. Changing the type for the sample rate argument to an int
solves this issue for me. But I am getting an error past that. It's possible these are inconsistencies between the Windows and Linux versions, I'm not sure.
I'll run it under Linux and see if it goes well tomorrow. I'll submit an issue if it does work there, so a patch for Windows can be made. I'll also rebase this branch with carykh:master
and add support for the YouTube downloader.
@DeflatedPickle Changing line 63 (55 in the old file) of jumpcutter.py from parser.add_argument('--sample_rate', type=float, default=44100, help="sample rate of the input and output videos")
to parser.add_argument('--sample_rate', type=int, default=44100, help="sample rate of the input and output videos")
solves the problem for me.
@will9183, then it seems like it is just an inconsistency. If it's not fixed in master
somebody should probably make an issue or pull for it. :lul:
@DeflatedPickle I just did. #73