Skip to content

Instantly share code, notes, and snippets.

@pinge
pinge / mobile.video.encoding.md
Last active October 22, 2024 06:22
Video and audio encoding for playback in Android and iOS devices

Video and audio encoding for playback in Android and iOS devices

This document aims to provide an easy way encode video optimized for playback in mobile devices that use the Android or the iOS operating systems.

libx264 is used for (single or two-pass) video encoding and libfdk_aac for audio encoding.

ffmpeg, libx264 and libfdk_aac settings are optimized for playback quality and compatibility on Android and iOS. There is extensive documentation and references for each of the settings used and contributions are very welcome :)

@pinge
pinge / ffmpeg.md
Last active July 18, 2023 18:51
FFmpeg Cheatsheet

FFmpeg

remove audio from video file

ffmpeg -i example.mp4 -c copy -an example_no_audio.mp4

extract audio track from video file without re-encoding

ffmpeg -i input.mp4 -vn -acodec copy audio_track.aac

Yolo_mark on Ubuntu 16.04 LTS

clone repo

git clone https://github.com/AlexeyAB/Yolo_mark.git
cd Yolo_mark

add linux yolo mark command

@pinge
pinge / iphone.ubuntu.md
Last active September 14, 2024 08:18
mounting iPhone storage in Ubuntu 16.04 LTS

mounting iPhone storage in Ubuntu 16.04 LTS

check if your device was recognized correctly

$ dmesg | grep ipheth
[62051.385352] ipheth 1-5:4.2: Apple iPhone USB Ethernet device attached
[62051.385437] usbcore: registered new interface driver ipheth

create mounting point and make it writable (optional)

dir1='image-builder-rpi'
dir2='gateway-image-builder-rpi'
IFS=$'\n'
for file in $(grep -Ilsr -m 1 '.' "$dir1"); do
diff -q "$file" "${file/${dir1}/${dir2}}"
done
# coding: utf8
"""
from http://orator.readthedocs.io/en/latest/migrations.html
orator.py is the default migration configuration file for the Orator ORM
this file uses the Config class, so we've decided to use sys.path.append() method at runtime to avoid having to specify
the PYTHONPATH environment variable, making required command line a bit more user friendly

fluentd setup

system tweaks
  • sudo vim /etc/security/limits.conf (append to EOF)

root soft nofile 65536 root hard nofile 65536

  • soft nofile 65536
#!/usr/bin/env python
import os
import sys
import base64
import json
# Add the lib directory to the path for Lambda to load our libs
sys.path.append(os.path.join(os.path.dirname(__file__), 'lib'))
WORLD_REGIONS = [
# -*- coding: utf-8 -*-
import unittest
from app.lib.geo import generate_convex_hull
class GenerateConvexHullTest(unittest.TestCase):
def test_generate_convex_hull_with_degenerate_input(self):
@pinge
pinge / tcpdump.md
Created February 11, 2016 20:29
tcpdump

dumping request and response headers from tcpdump in a human readable way:

sudo stdbuf -oL -eL /usr/sbin/tcpdump -A -s 10240 "tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)" | egrep -a --line-buffered ".+(GET |HTTP\/|POST )|^[A-Za-z0-9-]+: " | perl -nle 'BEGIN{$|=1} { s/.*?(GET |HTTP\/[0-9.]* |POST )/\n$1/g; print }'