Skip to content

Instantly share code, notes, and snippets.

@aisouard
aisouard / Makefile
Created May 22, 2015 00:56
Makefile for building with WebRTC
CXXFLAGS := -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DWEBRTC_TARGET_PC -DWEBRTC_LINUX \
-DWEBRTC_THREAD_RR -DEXPAT_RELATIVE_PATH -DGTEST_RELATIVE_PATH \
-DJSONCPP_RELATIVE_PATH \
-DWEBRTC_RELATIVE_PATH -DPOSIX -D__STDC_FORMAT_MACROS \
-DDYNAMIC_ANNOTATIONS_ENABLED=0 -DWEBRTC_POSIX=1 \
-Ithird_party/webrtc -Ipeeracle/lib -std=gnu++0x \
-pthread -fno-exceptions -fno-strict-aliasing -Wall -Wno-unused-parameter \
-Wno-missing-field-initializers -Wextra -Wno-unused-local-typedefs \
-Wno-uninitialized -Wno-unused-variable -Wno-unused-but-set-variable \
-pipe -fno-ident -fdata-sections -ffunction-sections -fPIC -fpermissive
>npm test
> [email protected] test C:\Users\vm\node-webrtc
> node test/all.js
TAP version 13
# create a peer connection
ok 1 created
# createOffer function implemented
ok 2 implemented
See my DASH-IF presentation from October, 2014:
https://s3.amazonaws.com/misc.meltymedia/dash-if-reveal/index.html#/
1. encode multiple bitrates with keyframe alignment:
ffmpeg -i ~/Movies/5D2_Portrait.MOV -s 1280x720 -c:v libx264 -b:v 1450k -bf 2 \
-g 90 -sc_threshold 0 -c:a aac -strict experimental -b:a 96k -ar 32000 out.mp4
My input was 30 fps = 3000 ms. If it were 29.97, then a GOP size of 90 frames will yield a base segment
size of 3003 milliseconds. You can make the segment size some multiple of this, e.g.: 6006, 9009, 12012.
@aisouard
aisouard / gist:feca4c78911a6107e4af
Created June 2, 2015 02:49
cURL configure line
./configure --enable-static --disable-shared --with-pic --disable-gopher --disable-smtp --disable-smb --disable-imap --disable-pop3 --disable-tftp --disable-telnet --disable-dict --disable-rtsp --disable-ldaps --disable-ldap --disable-file --disable-ftp --without-libssh2 --without-librtmp
@aisouard
aisouard / vlc-min-configure
Created June 5, 2015 05:49
vlc minimal configure
./configure --enable-static --disable-shared --disable-archive --disable-live555 --disable-dc1394 --disable-dv1394 --disable-linsys --disable-dvdread --disable-dvdnav --disable-bluray --disable-opencv --disable-smbclient --disable-dsm --disable-sftp --disable-v4l2 --disable-decklink --disable-gnomevfs --disable-vcdx --disable-vcd --disable-libcddb --disable-screen --disable-vnc --disable-freerdp --disable-realrtsp --disable-macosx-eyetv --disable-macosx-qtkit --disable-macosx-avfoundation --disable-asdcp --disable-dvbpsi --disable-gme --disable-sid --disable-ogg --disable-shout --disable-mkv --disable-mod --disable-mpc --disable-wma-fixed --disable-shine --disable-omxil --disable-omxil-vout --disable-rpi-omxil --disable-crystalhd --disable-mad --disable-mpg123 --disable-merge-ffmpeg --disable-gst-decode --disable-avcodec --disable-libva --disable-dxva2 --disable-vda --disable-avformat --disable-swscale --disable-postproc --disable-faad --disable-vpx --disable-twolame --disable-fdkaac --disable-quicktime --dis
@aisouard
aisouard / parse.c
Created June 8, 2015 02:32
Parseur de fichier de métadonnés
#include <stdio.h>
#include <stdlib.h>
unsigned int swap_uint32(unsigned int num) {
unsigned int swapped;
swapped = ((num >> 24) & 0xff) |
((num << 8) & 0xff0000) |
((num >> 8) & 0xff00) |
((num << 24) & 0xff000000);
return swapped;
cmake_minimum_required(VERSION 3.2)
project(libpeeracle)
add_definitions(-DWEBRTC_LINUX -DWEBRTC_POSIX -DPOSIX -DBUILD_LIBPEERACLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
file(GLOB SOURCE_FILES
peeracle/**/**/*.cc
peeracle/**/**/*.h
@aisouard
aisouard / peeracle-sample-1.cpp
Last active February 24, 2020 07:58
peeracle-sample-1
using namespace peeracle;
// Ouvrir le fichier de métadonnées
DataStreamInit init;
init.path = "./ma_video.peeracle";
DataStreamInterface *dataStream = new FileDataStream(init);
// Charger le fichier de métadonnées
MetadataInterface *metadata = new Metadata();
metadata->unserialize(dataStream);
@aisouard
aisouard / readVariableInt.js
Last active May 5, 2021 09:53
Reading an EBML variable-length integer
/**
* Read an EBML tag header or length and return their respective values into
* single numbers.
*
* @example
* var tagHeader = new Uint8Array([0x1A, 0x45, 0xDF, 0xA3, 0x01, 0x00, 0x00,
* 0x00, 0x00, 0x00, 0x00, 0x1F]);
* var tagId = readVariableInt(tagHeader, 4, 0);
* console.log('The current tag ID is: ', tagId.value, ', skipping ', tagId.size, ' bytes.');
* // The current tag ID is: 172351395, skipping 4 bytes.
@aisouard
aisouard / commands.sh
Created April 6, 2017 07:23
Raspbian + QEMU
mount 2017-03-02-raspbian-jessie-lite.img -o offset=$((137216 * 512)) /mnt/rpi/
emacs /mnt/rpi/etc/fstab # Comment the two lines under the first one
touch /mnt/rpi/etc/ld.so.preload
umount /mnt/rpi
qemu-system-arm -M versatilepb -cpu arm1176 -kernel kernel-qemu -hda 2017-03-02-raspbian-jessie-lite.img -serial stdio -no-reboot -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw"
mount 2017-03-02-raspbian-jessie-lite.img -o offset=$((137216 * 512)) /mnt/rpi/
emacs /mnt/rpi/etc/ld.so.preload # Comment the first line
umount /mnt/rpi