All Projects → mashingan → nimffmpeg

mashingan / nimffmpeg

Licence: MIT License
Nim FFMpeg binding

Programming Languages

c
50402 projects - #5 most used programming language
nim
578 projects

Projects that are alternatives of or similar to nimffmpeg

logger-node
A nodejs logger client for LogDNA
Stars: ✭ 27 (-6.9%)
Mutual labels:  lib
hibpwned
Python API wrapper for haveibeenpwned.com (API v3)
Stars: ✭ 21 (-27.59%)
Mutual labels:  binding
simplesquirrel
Yet another simple binding in C++11 for Squirrel scripting language
Stars: ✭ 37 (+27.59%)
Mutual labels:  binding
rust-tree-sitter
Rust bindings to Tree-sitter
Stars: ✭ 29 (+0%)
Mutual labels:  binding
xsdata
Naive XML & JSON Bindings for python
Stars: ✭ 144 (+396.55%)
Mutual labels:  binding
UIControlBinding
一种半自动控件绑定方案
Stars: ✭ 110 (+279.31%)
Mutual labels:  binding
node-libzim
Binding to libzim, read/write ZIM files in Javascript
Stars: ✭ 23 (-20.69%)
Mutual labels:  binding
nimjson
nimjson generates nim object definitions from json documents.
Stars: ✭ 37 (+27.59%)
Mutual labels:  lib
steampak
Nicely packed tools to work with Steam APIs
Stars: ✭ 21 (-27.59%)
Mutual labels:  binding
Assembly-Lib
A 16-bits x86 DOS Assembly library that provides many useful functions for developing programs. It has both VGA grapics functions as well as general purpose utilities. The main purpose of this library was to be able to implement simple DOS games (in Assembly) using VGA (320x200, 256 colors) display.
Stars: ✭ 36 (+24.14%)
Mutual labels:  lib
TinyMAT
C/C++ library to handle writing simple Matlab(r) MAT file
Stars: ✭ 22 (-24.14%)
Mutual labels:  lib
client-js
JS client for polygon.io api
Stars: ✭ 81 (+179.31%)
Mutual labels:  lib
numpyeigen
Fast zero-overhead bindings between NumPy and Eigen
Stars: ✭ 75 (+158.62%)
Mutual labels:  binding
TinyTIFF
lightweight TIFF reader/writer library (C/C++)
Stars: ✭ 91 (+213.79%)
Mutual labels:  lib
UIFramework
VBM UI Framework For Unity3D
Stars: ✭ 25 (-13.79%)
Mutual labels:  binding
reload
Simple managed reload mechanism for Go
Stars: ✭ 18 (-37.93%)
Mutual labels:  lib
openHAB-Simatic
openHAB binding for Siemens Simatic S7 PLC
Stars: ✭ 15 (-48.28%)
Mutual labels:  binding
webview
Nim bindings for https://github.com/zserge/webview
Stars: ✭ 91 (+213.79%)
Mutual labels:  binding
dotty dict
Dictionary wrapper for quick access to deeply nested keys.
Stars: ✭ 67 (+131.03%)
Mutual labels:  lib
observable ish
Observable state and events for browser and Flutter.
Stars: ✭ 26 (-10.34%)
Mutual labels:  binding

Nim FFMpeg Binding (WIP)

(Very) Thin FFMpeg C binding for Nim. The thin binding means it's almost same with FFMpeg C APIs.
The advantage is that we can reuse our C APIs knowledge using Nim seamlessly. We can reuse any FFMpeg C tutorials to work with.

Examples

Some snippet here can be used to get the first 5 video frame

var frameCount = 0
while frameCount < 5:
    if av_read_frame(pFrameContext, pPacket) < 0: # negative means it's error
        continue                                  # and we just skip this time
    
    if packet[].stream_index == videoIndex:       # we only process packet in specific index stream
                                                  # in this case it's video stream
        if avcodec_send_packet(pVideoCodecCtx, pPacket) < 0:  # negative means it's error
            continue
        if avcodec_receive_frame(pVideoCodecCtx, pFrame) < 0:
            continue
        doSomethingWith3YUVPlaneData(pFrame[].data) # pFrame[].data is array filled with YUV several planes
                                                    # pFrame[].data[0] is Y plane
                                                    # pFrame[].data[1] is U plane (or Cb be precise)
                                                    # pFrame[].data[2] is V plane (or Cr be precise)
        inc frameCount

Snippet to get the first video stream index

var videoIndex = -1
var streams = cast[ptr UncheckedArray[ptr AVStream]](pFormatCtx[].streams)
for i in 0 .. pFormatCtx[].nb_streams:
  let localparam = streams[i][].codecpar
  if localparam[].codec_type == AVMEDIA_TYPE_VIDEO:
    videoIndex = int i
    break

The index can be used later to know which stream index packet we'll process later.

Any others examples you found should be applicable with this binding too. Several worked examples also availables in examples folder.

To use

To able to compile and work with, make sure we installed shared lib to run it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].