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

FFmpegBuilder to parse the full ffmpeg command string #201

Closed
qinfchen opened this issue Sep 11, 2019 · 4 comments
Closed

FFmpegBuilder to parse the full ffmpeg command string #201

qinfchen opened this issue Sep 11, 2019 · 4 comments

Comments

@qinfchen
Copy link

qinfchen commented Sep 11, 2019

Is your feature request related to a problem? Please describe.
There is a wiki that shows examples of how to convert a ffmpeg command string to FFmpegBuilder instance. So it seems like many people have trouble converting some of the commands.

Describe the solution you'd like
It would be extremely helpful and useful if FFmpegBuilder can parse a ffmpeg command string and turn it to a FFmpeg instance. This would make this library a lot easier to use and more useful IMO.

@qinfchen qinfchen changed the title FFmpegBuilder to take in the command string FFmpegBuilder to parse the full ffmpeg command string Sep 11, 2019
@bramp
Copy link
Owner

bramp commented Sep 11, 2019

I guess if you just want a normal command line string, why not invoke ProcessBuilder directly? I think the purpose of the library is to construct the command line string.

However, I'm happy to understand the use case more.

@qinfchen
Copy link
Author

Sure. I have a service that runs these commands in separate threads and these commands are configurable by users. so I'd like to validate ffmepg arguments first and make sure that the command is valid to prevent arbitrary code execution.

@qinfchen
Copy link
Author

friendly ping, any thoughts?

@Euklios
Copy link
Collaborator

Euklios commented Mar 13, 2024

Sorry for the late update:

The way we and ffmpeg handle parameters makes this extremely hard.
A general ffmpeg command has the following structure:
ffmpeg {global options} ({input options} {input})+ ({output options} {output})+

We don't implement all existing options (not all documented default options).
We have to append extra options to global, input, and output to allow most commands still.

Currently, inputs are only partially supported, there not handled in the correct way. But even if we would handle them according to the specification, given a ffmpeg command like this: ffmpeg -y -unknown -to ..., We couldn't determine if the "unknown" flag should be mapped to the first input or if it belongs to the global options.

More severe: ffmpeg ... -unknown output.mp4 .... Depending on -unknown, output.mp4 might be an actual output file or another parameter.

Last: There is no existing code for us to perform a reverse mapping. This would essentially double our mappings, as we would have to do them both ways and add all the synonyms ffmpeg supports on top of that. I would love to implement this over our existing serialization method, but we must rewrite much of our internal handling.

We can approach a minimal version (without extra args) after #318 if you're still interested in this.
Feel free to re-open or start a new issue if interested.

@Euklios Euklios closed this as completed Mar 13, 2024
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

3 participants