Skip to content

Instantly share code, notes, and snippets.

View LeifAndersen's full-sized avatar

Leif Andersen LeifAndersen

View GitHub Profile
#lang scratch
(module untyped racket
(provide u)
(define (u . x)
x))
(module typed typed/racket
(require/typed (submod ".." untyped)
[u Any])
@LeifAndersen
LeifAndersen / example.rkt
Created May 23, 2017 20:17
video sample
#lang video
(require video/core)
(define screen
(make-producer #:type 'avformat
#:source "test.mov"
#:prop (hash "video_index"
0)))
libavcodec.dylib:
/opt/ffmpeg/lib/libavcodec.57.dylib (compatibility version 57.0.0, current version 57.89.100)
/opt/ffmpeg/lib/libswresample.2.dylib (compatibility version 2.0.0, current version 2.7.100)
/opt/ffmpeg/lib/libavutil.55.dylib (compatibility version 55.0.0, current version 55.58.100)
/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1404.47.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.5.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1259.0.0)
/System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, curre
digraph G {
node0 [label="(filter-node\n '#:filters\n (hash\n 'audio\n (filter \"asetpts\" '#hash((\"expr\" . \"PTS-STARTPTS\")) #f)\n 'video\n (filter \"setpts\" '#hash((\"expr\" . \"PTS-STARTPTS\")) #f))\n '#:props\n #<void>\n '#:counts\n '#hash((audio . 1) (video . 1)))\n"];
node1 [label="(filter-node\n '#:filters\n (hash\n 'audio\n (filter \"concat\" '#hash((\"v\" . 0) (\"a\" . 1) (\"n\" . 1)) #f)\n 'video\n (filter \"concat\" '#hash((\"v\" . 1) (\"a\" . 0) (\"n\" . 1)) #f))\n '#:props\n '#hash((\"width\" . 1920)\n (\"end\" . 20)\n (\"fps\" . 30)\n (\"height\" . 1080)\n (\"start\" . 0))\n '#:counts\n '#hash((audio . 1) (video . 1)))\n"];
node2 [label="(filter-node\n '#:filters\n (hash 'audio (filter \"afifo\" '#hash() #f) 'video (filter \"fifo\" '#hash() #f))\n '#:props\n '#hash()\n '#:counts\n '#hash((audio . 1) (video . 1)))\n"];
node3 [label="(filter-node\n '#:filters\n (hash 'audio (filter \"afifo\" '#hash() #f) 'video (filter \"fifo\" '#hash() #f))\n '#:props\n
$ racket -l errortrace -t render.rkt
digraph G {
node0 [label="#<sink-node>\n"];
node1 [label="#<source-node>\n"];
subgraph U {
edge [dir=none];
}
subgraph D {
node1 -> node0 [label="1"];
}
$ ffmpeg -i demo.mp4 -filter_complex "[a:0]asetpts=2*(PTS-STARTPTS)[fa]" -map "[fa]" out.mp3
ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
leif@FATT ~ $ ffprobe out.mkv
ffprobe version 3.3.2 Copyright (c) 2007-2017 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
$ ffprobe test.mp4
ffprobe version 3.3.2 Copyright (c) 2007-2017 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
# ./configure --enable-shared --disable-sdl2 --disable-indev=jack --libdir='@loader_path' --enable-libopenh264 --pkgconfigdir=/Users/leif/src/openh264
ALL_COMPONENTS='
aac_adtstoasc_bsf
chomp_bsf
dump_extradata_bsf
dca_core_bsf
extract_extradata_bsf
h264_mp4toannexb_bsf
hevc_mp4toannexb_bsf
imx_dump_header_bsf
#lang racket
(require ffi/unsafe
ffi/unsafe/define
ffi/unsafe/define/conventions
ffi/unsafe/alloc
setup/dirs)
(define-ffi-definer define-avutil (ffi-lib "libavutil" "55")
#:make-c-id convention:hyphen->underscore)