Categoryav

Audio/video related topics

Capture video using ffmpeg with an Intensity Pro and compress using VA-API

Hardware accelerated video capturing using VA-API and a Blackmagic Intensity Pro: H.264 video, FLAC audio. Needs a snapshot ffmpeg build with latest Blackmagic SDK & libva: --enable-decklink --enable-vaapi.

ffmpeg -v verbose -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -format_code ntsc -f decklink -i 'Intensity Pro' -c:a flac -compression_level:a 7 -vf 'format=nv12,hwupload' -c:v h264_vaapi -global_quality 10 -y output.mkv

Color correction of VHS recordings

Calculated using Moth3r’s spreadsheet by recording a test card to a new blank VHS tape.

Panasonic DMR-EZ49V (PAL machine in NTSC mode):

ColorYUV(gain_y=11.11, off_y=3.34, gamma_y=-18.49, off_u=0.92, cont_u=27.20, off_v=0.83, cont_v=41.55)

JVC DR-MV5S (NTSC machine):

ColorYUV(gain_y=23.22, off_y=1.44, gamma_y=-14.03, off_u=2.21, cont_u=40.83, off_v=2.70, cont_v=22.24)

Remaining mean error <=3.

Apply delay to MKV/eac3to chapter files

Small bash script to apply a delay to MKV/eac3to chapter files (CHAPTERXX=/CHAPTERXXNAME= format):

#!/bin/bash
# usage: ./chapshift.sh "+0.792 seconds" < <input> > <output>
set -o errexit -o noclobber -o nounset -o pipefail

date_offset="$1"

apply_delay() {
    date --date="$1 $date_offset" +%T,%N | cut -c 1-12
}

while read -r origline
do
    line=`echo ${origline} | sed 's/\=/\=\ /g' | sed 's/\n//g'`
    if [[ $line =~ ^CHAPTER[0-9][0-9]=\ [0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9] ]]
    then
        read -r chapter start_date <<<"$line"
        if [[ $start_date =~ 00:00:00.000.* ]]
        then
            new_start_date="00:00:00.000"
        else
            new_start_date="$(apply_delay "$start_date")"
        fi
        chapter=`echo ${chapter} | sed 's/=\ /=/g'`
        new_start_date=`echo ${new_start_date} | sed 's/\,/\./g'`
        printf "%s%s\n" "${chapter}" "$new_start_date"
    else
        printf "%s\n" "$origline"
    fi
done