Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Export script instead of running FFMPEG directly #612

Closed
quorten opened this issue Jan 24, 2021 · 7 comments
Closed

[Feature request] Export script instead of running FFMPEG directly #612

quorten opened this issue Jan 24, 2021 · 7 comments

Comments

@quorten
Copy link
Contributor

quorten commented Jan 24, 2021

The most basic implementation would be to write the generated FFMPEG commands to a shell script file rather than executing. The export parameters and CSV project file are listed in comments at the top.

Alternatively, a Python script could be used that reads the parameters from the top and then parse them out using the same logic inside LosslessCut's JavaScript code.

Mainly I'm opening this issue for discussion since I was planning on implementing something similar for my own use and was curious if you'd be interested a pull request to merge this to master.

@mifi
Copy link
Owner

mifi commented Jan 24, 2021

Hi. what's the use case for this?

@quorten
Copy link
Contributor Author

quorten commented Jan 25, 2021

I'm using a very simple pipeline/build system for some video edits with a number of stages, so the idea is just to have some very simple code structure I can drop into the pipeline I've coded up, one that is only a plain scripting language with only dependencies on FFMPEG, excluding the web app dependencies used by the LosslessCut GUI. Beyond the CSV files, there's a few additional user data points that need to be included for full reproducibility of the edit actions.

Another point, sometimes we point users to running FFMPEG directly for diagnosing bugs, but is there currently any way to easily get the commands that LosslessCut generates? Another related idea I was thinking, maybe we just want a console window of a sort within LosslessCut to view the commands that are run.

But anyway, my overall thoughts. I like the idea that LosslessCut is largely a lightweight GUI front-end to FFMPEG and it seems like it could use a few improvements toward making its interaction with FFMPEG a little bit more transparent/discoverable to the user.

@Shakil-Shahadat
Copy link
Contributor

Another point, sometimes we point users to running FFMPEG directly for diagnosing bugs, but is there currently any way to easily get the commands that LosslessCut generates?

Yes, press H and then scroll down.

@quorten
Copy link
Contributor Author

quorten commented Jan 25, 2021

Okay, yeah now I see the last run FFMPEG commands on the bottom of the help screen, a bit of an inconvenience that you need to actually run the export first before seeing them but it's still workable. Also, I did not see the final merge command all in the command output log, it should have listed that command line with the segments to merge passed in as a here document (since the command pipes from standard input).

@mifi So what are your thoughts on this overall idea? There's a number of ways to proceed here. I've written a proof of concept Python script for just parsing out the project files and generating FFMPEG commands.

  • Since processing the file format is fairly simple, it could be that we mainly focus on creating additional "file format specification" documentation and leave it up to users to write the script for their own use. Also related would be further pursuing the a richer JSON file format mentioned in previous GitHub issues, this would better allow for implementation reproducible exports.

  • We could just add the ability to generate "dry run" commands by generating the command lines but not executing them, then this can just go to the last run commands. We can also add the ability to save the last run commands to a file in addition to copying to the clipboard.

  • We could include a more fleshed out version of the script I've written inside LosslessCut and add documentation referencing it and the intended use case. If you don't like the idea of holding the (possibly richer) file format to a rigid specification and propagating updates across two versions of code to process it, you'd probably want to stay away from this idea.

  • Or we could just close this issue if you don't think any of these changes are worthwhile to be merged to the master version.

@mifi
Copy link
Owner

mifi commented Jan 26, 2021

I think if I understand you correctly, you need a modified version of losslesscut to integrate into your own software stack. In such case I think it should be easy for you to fork losslesscut and then make the changes you need for that. I'm not sure if it would be very useful for others, but we can leave it open to see if any others are interested in this.
The main goal of losslesscut is to be an easy way for people to cut their files effectively, and do other operations, so it's kind of out of the scope of losslesscut unless there is some really good reason that will increase many users' productivity a lot

@quorten
Copy link
Contributor Author

quorten commented Jan 27, 2021

Thinking this through more, a lot of the practicality of implementing what I really want really hinges off of issue #545. Probably it's best explained like this. Inkscape has a command-line export and that is really nifty if you want to graphically author something, store the source in version control, but be able to also plumb it into a build system for generating the production image.

But in any case for that to work well in general, LosslessCut needs to be able to generate project files that encapsulate all relevant parameters in them. I think it's fair to close this issue for now and we can reopen when #545 (or similar) is addressed.

@quorten quorten closed this as completed Jan 27, 2021
@couleurm
Copy link

I would definitely find a use for this, I use VapourSynth scripts and having a nice GUI that exports the video to TEMP and runs a command right after trimming would be convenient

Of course very few people would use something like this but it would be really useful for me to be able to customize the output command somewhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants