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

Giving ffmpeg options defeats the purpose #69

Open
lodenrogue opened this issue Jul 17, 2023 · 0 comments
Open

Giving ffmpeg options defeats the purpose #69

lodenrogue opened this issue Jul 17, 2023 · 0 comments

Comments

@lodenrogue
Copy link

lodenrogue commented Jul 17, 2023

Giving the command line options like below defeats the purpose of having a python wrapper for FFmpeg:

>>> ff = FFmpeg(
...     inputs={'input.ts': None},
...     outputs={'output.mp4': '-c:a mp2 -c:v mpeg2video'}
... )

and

>>> ff = FFmpeg(
...     inputs={'input.ts': None},
...     outputs={
...         'video.mp4': ['-map', '0:0', '-c:a', 'copy', '-f', 'mp4'],
...         'audio.mp4': ['-map', '0:1', '-c:a', 'copy', '-f', 'mp4']
...     }
... )

Instead consider using an object oriented approach to do the same thing:

input = InputBuilder(fileName)
    .codec(codec)
    .filter(filter)
    ... etc
    .build()
    
ff = FFmpeg(
    inputs = [input],
    outputs = [output]
)

ff.run()

With this approach you gain the following:

  1. Hide away the implementation details of ffmpeg
  2. Allow the user to work at a higher level of abstraction
  3. Remove the need to understand both ffmpeg and your wrapper
  4. Abstract complex behavior behind simple interfaces
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

1 participant