Skip to content

Instantly share code, notes, and snippets.

@dericed
dericed / barcode2dublist.xsl
Created January 23, 2012 22:03
xsl to translate filemaker output to dublist.xml
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:fmp="http://www.filemaker.com/fmpxmlresult" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="fmp xsl">
<xsl:output encoding="UTF-8" method="xml" version="1.0" indent="yes"/>
<xsl:key name="N" match="/fmp:FMPXMLRESULT/fmp:METADATA/fmp:FIELD" use="@NAME"/>
<xsl:key name="N" match="/fmp:FMPXMLRESULT/fmp:METADATA/fmp:FIELD" use="following-sibling::fmp:FIELD/@NAME"/>
<xsl:template match="fmp:FMPXMLRESULT">
<xsl:apply-templates select="fmp:RESULTSET"/>
</xsl:template>
<xsl:template match="fmp:FMPXMLRESULT/fmp:RESULTSET">
<PBSDubList>
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" extension-element-prefixes="str" xmlns="http://www.filemaker.com/fmpxmlresult">
<xsl:output encoding="UTF-8" method="xml" version="1.0" indent="yes"/>
<xsl:template match="orders">
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="06-18-2009" NAME="FileMaker" VERSION="ProAdvanced 10.0v3"/>
<DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT="h:mm:ss a"/>
<METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="orderId" TYPE="NUMBER"/>
@dericed
dericed / ffprobe2premis.xsl
Created August 7, 2012 22:57
use like "ffprobe -show_format -show_streams -show_versions -show_error -noprivate -print_format xml=q=1:x=1 MOVIE.mov 2>/dev/null | xsltproc ffprobe2premis.xsl -
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="info:lc/xmlns/premis-v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ffprobe="http://www.ffmpeg.org/schema/ffprobe" version="1.0">
<xsl:output encoding="UTF-8" method="xml" version="1.0" indent="yes"/>
<xsl:template match="@width | @height">
</xsl:template>
<xsl:template match="ffprobe:ffprobe">
<premis>
<xsl:attribute name="version">
<xsl:text>2.2</xsl:text>
</xsl:attribute>
@dericed
dericed / ffv1_test_sizes_and_pixel_formats.sh
Created August 8, 2012 00:58
run without any arguments to produce random video files and test lossless encoding with ffv1 version 1 and 3
#!/bin/bash
for frame_size in sqcif qcif cif whuxga cga hd720 hd1080 ; do
for pixel_format in yuv420p yuva420p yuva422p yuv444p yuva444p yuv440p yuv422p yuv411p yuv410p yuv420p16 yuv422p16 yuv444p16 yuv444p9 yuv422p9 yuv420p9 yuv420p10 yuv422p10 yuv444p10 yuv444p9le yuv422p9le yuv420p9le yuv420p10le yuv422p10le yuv444p10le gray16le gray rgb24 ; do
# create 1 seconds of random video data
ffmpeg -y -f rawvideo -s "$frame_size" -pix_fmt "$pixel_format" -t 1 -i /dev/random -f rawvideo "random_${pixel_format}_${frame_size}.raw" 2> /dev/null
# make framemd5 file of random data
ffmpeg -y -f rawvideo -s "$frame_size" -pix_fmt "$pixel_format" -i "random_${pixel_format}_${frame_size}.raw" -f framemd5 "random_${pixel_format}_${frame_size}.md5" 2> /dev/null
# encode random data to ffv1 version 1
ffmpeg -y -f rawvideo -s "$frame_size" -pix_fmt "$pixel_format" -i "random_${pixel_format}_${frame_size}.raw" -c:v ffv1 "random_${pixel_format}_${frame_size}_ffv1_v1.mov" 2> /dev/null
# encode random data to ffv1 v
@dericed
dericed / ffv1_tests.sh
Created August 8, 2012 01:09
test ffv1 version 1 and 3 against test files (available at http://media.xiph.org/video/derf/y4m/)
#!/bin/bash
for test_file in bridge_far_cif.y4m bridge_close_cif.y4m foreman_cif.y4m bowing_cif.y4m akiyo_cif.y4m stefan_sif.y4m stefan_sif_mono.y4m foreman_qcif.y4m foreman_qcif_mono.y4m ; do
# make framemd5 file of random data
ffmpeg -y -report -i "$test_file" -f framemd5 "${test_file}.md5" 2> /dev/null
# encode random data to ffv1 version 1
ffmpeg -y -report -i "$test_file" -c:v ffv1 "${test_file%.*}_ffv1_v1.mov" 2> /dev/null
# encode random data to ffv1 version 3
ffmpeg -y -report -i "$test_file" -c:v ffv1 -level 3 -strict experimental "${test_file%.*}_ffv1_v3.mov" 2> /dev/null
# generate framemd5 from encoded ffv1
ffmpeg -y -report -i "${test_file%.*}_ffv1_v1.mov" -f framemd5 "${test_file%.*}_ffv1_v1.md5" 2> /dev/null
@dericed
dericed / ffmpeg pixel formats
Created August 11, 2012 00:35
snapshot of pixel format list from ffmpeg, ffmpeg version 0.11.1.git built on Aug 8 2012 11:29:53
Pixel formats:
I.... = Supported Input format for conversion
.O... = Supported Output format for conversion
..H.. = Hardware accelerated format
...P. = Paletted format
....B = Bitstream format
FLAGS NAME NB_COMPONENTS BITS_PER_PIXEL
-----
IO... yuv420p 3 12
IO... yuyv422 3 16
@dericed
dericed / gist:3958826
Created October 26, 2012 13:29
List of AMIA Screnning Night institutional participants 2005-2011
Very rough list of institutions that have participated in AMIA Screening Night from 2005 through 2011. First column is the number of occurrences and second is the name of the institution. Note: Accurately grepping pdf is hard.
1 A/V Geeks, LLC
1 Academic Film Archive of North America
3 Academy Film Archive
1 Academy Film Archive, Los Angeles
1 Alan Mason Chesney Medical Archives of the
1 Alaska Moving Image Preservation Assoc.
1 American Folklife Center, LOC
1 Anthology Film Archive
@dericed
dericed / gist:4590870
Created January 22, 2013 00:21
This is a list of the volume of the AMIA listserv month by month. The second column indicates the total number of messages sent within the month. The third column is the value of the second column divided by 30 which provides a rough approximate of the volume of that month's average daily postings.
year_month message_per_month messages_per_month_div_30
amia-l/00/01 72 2
amia-l/00/02 207 6
amia-l/00/03 214 7
amia-l/00/04 196 6
amia-l/00/05 186 6
amia-l/00/06 110 3
amia-l/00/07 139 4
amia-l/00/08 290 9
amia-l/00/09 181 6
@dericed
dericed / larsencoder.sh
Last active December 12, 2015 02:08
shell script for converting DPX+wav input to specific outputs of DNxHD, lossless h264 at 4:2:2 YUV 10 bit, and a streamable h264
#!/bin/bash
# larsencoder.sh
# author: dave rice dave@dericed.com
# description: This is a very specific script intended to take a collection of DPX images and a WAV audio file as an input and then create multiple derivatives using ffmbc and libx264
# dependencies: The script expects to use ffmpeg version 1.1 or higher compiled with libx264 and libfaac. Configure libx264 with either --bit-depth=8 or --bit-depth=10 as you wish.
# testing: If you need to generate sample files for testing this script I recommend making them via:
# ffmpeg -f lavfi -i testsrc=s=1920x1080:d=10:r=ntsc-film -start_number 100000 dpx_package_path/images/%06d.dpx
# ffmpeg -f lavfi -i aevalsrc="sin(440*2*PI*t):cos(430*2*PI*t)::c=stereo:s=48000:d=10" -c pcm_s24le dpx_package_path/audio/1.wav
usage(){
@dericed
dericed / markinout.sh
Created March 21, 2013 06:38
testing method to mark in and out of video using ffplay to support an edit
#!/bin/bash
# edit
mknod /tmp/stats p > /dev/null 2>&1
trap 'rm /tmp/stats' 0
printf "Enter a file: "
read input
echo "OK will try to play it."
ffplay "$input" -vf "showinfo,scale=360:240,split=3[v1][v2][v3],[v1]pad=iw*3[pad],[v2]setpts=PTS-0.5/TB[d1],[pad][d1]overlay=w[pad2],[v3]setpts=PTS-1/TB[d2],[pad2][d2]overlay=w*2" 2>&1 | tr '\r' '\n' > stats &
echo "Should be playing now."