<story><title>Ffmpeg-Python: Python bindings for FFmpeg – with complex filtering support</title><url>https://github.com/kkroening/ffmpeg-python</url></story><parent_chain></parent_chain><comment><author>paol</author><text>FYI, the term &amp;quot;binding&amp;quot; is slightly misleading here. This is not bindings for the FFMPEG libraries, it&amp;#x27;s just an API frontend to invoke the `ffmpeg` command.&lt;p&gt;For actual python bindings check out PyAV [0]&lt;p&gt;[0] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;mikeboers&amp;#x2F;PyAV&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;mikeboers&amp;#x2F;PyAV&lt;/a&gt;</text></comment>
<story><title>Ffmpeg-Python: Python bindings for FFmpeg – with complex filtering support</title><url>https://github.com/kkroening/ffmpeg-python</url></story><parent_chain></parent_chain><comment><author>johnchristopher</author><text>Really nice.&lt;p&gt;&amp;gt; The corresponding command-line arguments are pretty gnarly:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    ffmpeg -i input.mp4 -i overlay.png -filter_complex &amp;quot;[0]trim=start_frame=10:end_frame=20[v0];\
    [0]trim=start_frame=30:end_frame=40[v1];[v0][v1]concat=n=2[v2];[1]hflip[v3];\
    [v2][v3]overlay=eof_action=repeat[v4];[v4]drawbox=50:50:120:120:red:t=5[v5]&amp;quot;\
    -map [v5] output.mp4
&lt;/code&gt;&lt;/pre&gt;
I have actually written scripts that would generate such horrors but north of 2000 characters :].&lt;p&gt;&amp;gt; If you&amp;#x27;re like me and find Python to be powerful and readable, it&amp;#x27;s easier with ffmpeg-python:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    import ffmpeg

    in_file = ffmpeg.input(&amp;#x27;input.mp4&amp;#x27;)
    overlay_file = ffmpeg.input(&amp;#x27;overlay.png&amp;#x27;)
    (
        ffmpeg
        .concat(
            in_file.trim(start_frame=10, end_frame=20),
            in_file.trim(start_frame=30, end_frame=40),
        )
        .overlay(overlay_file.hflip())
        .drawbox(50, 50, 120, 120, color=&amp;#x27;red&amp;#x27;, thickness=5)
        .output(&amp;#x27;out.mp4&amp;#x27;)
        .run()
    )&lt;/code&gt;&lt;/pre&gt;</text></comment>