Skip to content

Giving ffmpeg options defeats the purpose #69

@lodenrogue

Description

@lodenrogue

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions