aliakseis / FFmpegPlayer

Simple FFmpeg video player
MIT License
151 stars 44 forks source link

player re-encodes when saving clip #39

Open ghost opened 1 year ago

ghost commented 1 year ago

well, basically what's on the title. by re-encoding the entire video when doing such function, it not only takes way longer than it should but the process result in a file with different video encoding, audio encoding, encoding settings, less bitrate, and other issues related to re-encoding. it also strips the file from its fonts. A HEVC - FLAC file was turned into a AVC - AAC one.

that said, the player itself is actually pretty good, feeling as responsive as mpv, which is quite the feat. if you manage to create one interface for the player, and one for the video cutter, this would get really interesting. our current video-cutters are losslesscut and vidcutter, both of which run on under-performant languages (electron and python, respectively). if this program manages to do, in video cutting, what losslesscut and vidcutter do, it would be the program of choice for those who were using the other 2 I mentioned. cutting feature is quite useless if it does re-encoding; ideally, it should just cut the video while preserving all information. it's faster and better.

aliakseis commented 1 year ago

Lossless cut is basically implemented. I think that ultimately it might make sense reusing this stuff as a Python library if more functionality is needed: https://github.com/ozmartian/vidcutter/blob/master/vidcutter/videocutter.py

ghost commented 1 year ago

I'll test it and posts the results here

ghost commented 1 year ago

btw, when I installed the program, there was a rather odd warning on the setup: "WARNING: This program is protected by copyright law and international treaties. Unauthorized duplication or distribution of this program, or any portion of it, may result in severe civil or criminal penalties, and will be prosecuted to the maximum extent possible under the law."

considering the MIT license, I don't think that's exactly the case

ghost commented 1 year ago

ok, confirmed space key now works as play/pause. (key?)frame cut also seems to work as intended, though I think this was already a feature oh, amazing, now you can hide the "range" thing. was this a feature before? I don't recall. autoplay and looping too, I don't remember seeing those. you could also implement mouse scroll and up/down as volume control, as well as left/right to go backwards/forwards on the video. shift+key to increase the step. f11 to go fullscreen too.

bug: the player doesn't seem to want to save a file if you rename it in the saving process. I could only save it by keeping the original file name.

well, that's beautiful. I checked the files on media info against the original file and an equal cut performed by losslesscut, and they seem to be the same, with something like +- .1 difference in frame rate and +- 10 difference in bit rate, which is virtually the same video. it still didn't keep the fonts, though, but I believe it is an easy fix. it's not hard to extract the fonts with gmkvextract, either. it also didn't extract chapters which, again, it's not that big of a deal. you could make some kind of prompt with options like: import video, import audio, import subtitles, import fonts, import chapters. as in you could import all of them, one of them, a couple of them, and so on. keyframe step+lossless cut should also be default options, as they are not only better, but faster and prevent errors. in fact, I don't see a reason behind a non-lossless cut, as video encoders would prefer to set the parameters themselves, and the average user would get a bit puzzled to see his cut taking 10 minutes with a command prompt popup.

this program has pretty much 90% of the functionality of losslesscut/vidcutter with ~1/40th of the file size: this runs on 4MB of ram, losslesscut and vidcutter run each on around 150MB - the latter takes solid 10 seconds to start.. man, you know when the program is great when it uses 1 digit of ram. not to mention the responsiveness akin to mpv.

to sum it up

suggestions:

important

1 - mouse scroll and up/down keys as volume control 2 - left/right keys to go backwards/forwards on the video 3 - shift key + control to increase the step of the previously mentioned commands 4 - f11 to enable/disable fullscreen 5 - lossless cut as default, perhaps even eliminate non-lossless cut altogether 6 - import fonts and chapters

less important

7 - be able to choose what to export: video, audio, subs, attachments (fonts+chapters) - and export all by default 8 - right-click menu 9 - buttons to go forwards/backwards on chapters 10 - full keyboard integration 11 - if that's not implemented already, make it always play the default audio/sub track by default, and put the "sub track" option below "audio track" - some videos (rare, but it happens) have more than 1 video track so you could make it: video speed, video track, audio track, sub track, then open subs options, then the other already-existent options below 12 - make it an option to input timestamp to the start-end cut instead of frame count 13 - consider changing the icon not to get harassed by nintendo in the future, this might not really happen but nintendo is nintendo so...

bug:

1 - player won't save the file if you rename it