Skip to main content

YouTube video clip to DVD in one command

You may wish to alter the device on which the DVD is burned via (/dev/sr0 in the example) or the default burn speed, or you may have a more appropriate place to store up to maybe 9GB of temporary files (the DVD content plus an ISO file of the same), however this one command turns a downloaded YouTube clip into a push-in-n-it-plays DVD:

#!/bin/sh
if [ -f "$1" ]; then
    LEN=$(ffmpeg -i "$1" 2>&1 |gawk '/ Duration: / { print gensub(":[0-9][0-9]\\.[0-9][0-9],", "", "g", $2); }')
    if [ $LEN = "" ]; then
        echo No video minutes seen in the file "'$1'"
        return 1
    fi
else
    echo File "'$x'" does not appear to exist or is a dir or device-node
    return 1
fi
rm -rf /tmp/DVD_temporary /tmp/DVD_temporary.iso /tmp/temporary.xml /tmp/temporary.jpg
nice ffmpeg -i "$1" -target ntsc-dvd -y /tmp/temporary.mpg
cat <<ENDOFFILE > /tmp/temporary.xml
<dvdauthor>
    <vmgm />
    <titleset>
        <titles>
            <pgc>
            <vob file="/tmp/temporary.mpg" />
            </pgc>
        </titles>
    </titleset>
</dvdauthor>
ENDOFFILE
dvdauthor -o /tmp/DVD_temporary -x /tmp/temporary.xml
mkisofs -dvd-video -udf -o /tmp/DVD_temporary.iso /tmp/DVD_temporary
wodim -eject -v dev=/dev/sr0 /tmp/DVD_temporary.iso

It is also not too difficult to fetch YouTube downloading scripts & alter this script a little so that “nameofscript http://www.youtube.com/watch?v=ABC123DEF456” (insert real YourTube URL here) results in a clip being downloaded (in off-peak time if it suits) & burned to whatever blank DVD happens to be in the drive about 3 minutes after the download completes.

Comments

Popular posts from this blog

new life for an old (FTX) PSU, improved life for one human

the LEDs on this 5m strip happen to emit light centred on a red that does unexpectedly helpful things to (and surprisingly deeply within) a human routinely exposed to it. it has been soldered to a Molex connector, plugged into a TFX power supply from a (retired: the MoBo is cactus) Small Form Factor PC, the assorted PSU connectors (and loose end from the strip) have been taped over. the LED strip cost $10.24 including postage, the rest cost $0, the PSU is running at 12½% of capacity, consumes less power than a laptop plug-pack despite running a fan. trial runs begin today.

every-application-is-part-of-a-toolkit at work

I have a LibreOffice Impress slideshow that I wish to turn into a narrated video. 1. export the slideshow as PNG images (if that is partially broken — as at now — at higher resolutions, Export Directly as PDF then use ‘pdftoppm’ (from the poppler-utils package) to do the same). 2. write a small C program (63 lines including comments) to display those images one at a time, writing a config file entry for Imagination (default transition: ‘cross fade’) based on when the image-viewer application (‘display,’ from the GraphicsMagick suite) is closed on each one; run that, read each image aloud, then close each image in turn. 3. run ‘Imagination’ over the config file to produce a silent MP4 video with the correct timings. 4. run ‘Audacity’ to record speech while using ‘SMPlayer’ to display the silent video, then export that recording as a WAV file. 4a. optionally, use ‘TiMIDIty’ to convert a non-copyright-encumbered MIDI tune to WAV, then import that and blend it with the speech (as a quiet b...

boundaries

pushing the actual boundaries of the physical (not extremes, the boundaries themselves) can often remove barriers not otherwise perceived. one can then often resolve an issue itself, rather than merely stonewalling at the physical consequences of the issue.