Re: Import a whole bunch of dv files?

Michael Shigorin <[email protected]> Thu, 27 Dec 2012 22:51:56 +0200
Newsgroups gmane.comp.video.kino.devel
Message-ID <[email protected]>
--fdj2RfSjLxBAspz7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Dec 27, 2012 at 02:59:54PM -0500, . wrote:
> Is there a way to bulk import a bunch of DV files into Kino?

I've made a script several years ago, maybe it will be useful
to you as well.

-- 
 ---- WBR, Michael Shigorin <[email protected]>
  ------ Linux.Kiev http://www.linux.kiev.ua/

--fdj2RfSjLxBAspz7
Content-Type: application/x-sh
Content-Disposition: attachment; filename="kino-dv2smil.sh"
Content-Transfer-Encoding: quoted-printable

#!/bin/sh=0A# a script to create a SMIL file (*.kino) for a bunch of raw DV=
 files=0A# 2008, Michael Shigorin <[email protected]>=0A# thanks Dan Denned=
y <[email protected]> for main hint=0A# feel free to use, modify and distribu=
te=0A=0AOUT=3D"generated.kino"=0ABODY=3D"`mktemp`"=0AVERBOSE=3D=0AFORCE=3D=
=0A=0A# PAL=0ABPF=3D144000=0AFPS=3D25=0A=0Ausage()=0A{=0A	echo "Usage: $0 [=
-v] [-o generated.kino] file.dv ..."=0A	echo "       -o: specify SMIL file =
name to create"=0A	echo "       -f: force (over)writing output file"=0A	ech=
o "       -v: verbose output"=0A	echo=0A}=0A=0Aopts=3D`getopt -o 'f,h,o:,v'=
 -- $*` || continue=0Aeval set -- $opts=0A=0Awhile [ $# -gt 0 ]; do=0A	case=
 "$1" in=0A		# TODO: constants for other frame standards?=0A		-f) FORCE=3Dy=
es;;=0A		-o) OUT=3D"$2"; shift;;=0A		-v) VERBOSE=3Dyes;;=0A		-h) usage >&2;=
 exit 1;;=0A		--) shift; break;;=0A		*.dv) break 2;;=0A	esac=0A	shift=0Adon=
e=0A=0Acalc_f() { echo "scale=3D3; $@" | bc; }=0Acalc_i() { echo "scale=3D0=
; $@" | bc; }=0A=0A# any bc there?=0Acalc_i "quit" >&/dev/null || {=0A	echo=
 "$0: need bc(1), please provide" >&2=0A	exit 2=0A}=0A=0A# try not to stomp=
 on an existing SMIL=0A[ -s "$OUT" -a -z "$FORCE" ] && {=0A	echo "$0: $OUT =
already exists, exiting (-f to override)" >&2=0A	exit 3=0A} || :> "$OUT"=0A=
=0A# main loop: calculate length in seconds, break down into hh:mm:ss=0Afor=
 f in "$@"; do=0A	size=3D"`stat -c %s "$f"`"=0A	# SMIL has 0-based frame ti=
mes, we operate duration=0A	# which is off-by-one; http://tinyurl.com/thank=
s-dan=0A	length=3D"`calc_f "(($size/$BPF) - 1) / $FPS"`"=0A	hours=3D"`calc_=
i "$length/3600"`"=0A	length=3D"`calc_f "$length - $hours*3600"`"=0A	minute=
s=3D"`calc_i "$length/60"`"=0A	length=3D"`calc_f "$length - $minutes*60"`"=
=0A	seconds=3D"`calc_i "$length/1"`"=0A	msecs=3D"`calc_i "($length - $secon=
ds)*1000/1"`"	# scale alone isn't enough=0A	timecode=3D"`printf '%02d:%02d:=
%02d.%03d' "$hours" "$minutes" "$seconds" "$msecs"`"=0A	[ -z "$VERBOSE" ] |=
| printf '%s:\t%.3f sec\t(%s)\n' "$f" "$length" "$timecode"=0A	echo "    <s=
eq>" >> "$BODY"=0A	echo "      <video src=3D\"$f\" clipBegin=3D\"00:00:00.0=
00\" clipEnd=3D\"$timecode\"/>" >> "$BODY"=0A	echo "    </seq>" >> "$BODY"=
=0Adone=0A=0A# flush things=0A[ -s "$BODY" ] && {=0A	cat << __EOF__ >> "$OU=
T"=0A<?xml version=3D"1.0"?>=0A<smil xmlns=3D"http://www.w3.org/2001/SMIL20=
/Language">=0A  <body>=0A__EOF__=0A	cat "$BODY" >> "$OUT"=0A	cat << __EOF__=
 >> "$OUT"=0A  </body>=0A</smil>=0A__EOF__=0A	rm "$BODY"=0A	[ -z "$VERBOSE"=
 ] || echo "Wrote: $OUT"=0A}=0A
--fdj2RfSjLxBAspz7
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
--fdj2RfSjLxBAspz7
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Kino-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kino-dev

--fdj2RfSjLxBAspz7--