Giter Site home page Giter Site logo

ffmpeg_wrapper's Introduction

ffmpeg wrapper

ffmpeg wrapper starts an ffmpeg process and hooks the WM_CLOSE event sent by windows when a taskkilll command is sent to the wrapper's process. The wrapper then shuts down the child ffmpeg process it started gracefully to avoid file corruption issues.

This is meant to be shipped alongside ffmpeg in cases where the only way to tell ffmpeg to shut down gracefully is to send a taskkill command(ffmpeg is being used by host software that needs to interrupt ffmpeg). ffmpeg doesn't run with a window handle unless you specifically give ffmpeg a window handle using the start command. This still doesn't fix the fact that ffmpeg is not designed to handle this edge case. ffmpeg doesn't handle any WM_CLOSE event, so assigning a window handle isn't enough.

Don't use the /F option or the WM_CLOSE event isn't fired and the wrapper will fail to shut down ffmpeg gracefully.

Compiling

ffmpeg_wrap is written with nim. You need wnim and winim if you want to compile ffmpeg_wrap. You can use nimble to get both.

nimble install winim nimble install wnim

The resulting binary is around 1.5mb, but if you compile with the --opt:size flag it's less than 700kb

Example Usage

This will record a section of your screen until you run taskkill /PID FFMPEG_WRAPPER_PID

ffmpeg_wrap.exe ffmpeg.exe -rtbufsize 150M -f gdigrab -framerate 30 -offset_x 448 -offset_y 240 -video_size 1024x600 -draw_mouse 1 -show_region 1 -i desktop -r 30 -preset ultrafast -tune zerolatency -movflags +faststart screen-recording.mp4

ffmpeg_wrapper's People

Contributors

rattleycooper avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.