<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Duq Amuq</title>
	<atom:link href="http://duq.ca/duqamuq/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://duq.ca/duqamuq</link>
	<description>It's system administration season!</description>
	<lastBuildDate>Thu, 10 Nov 2011 21:13:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Creating Camera Ready Artwork Using the Gimp</title>
		<link>http://duq.ca/duqamuq/?p=406</link>
		<comments>http://duq.ca/duqamuq/?p=406#comments</comments>
		<pubDate>Wed, 09 Nov 2011 23:43:07 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[publishing]]></category>
		<category><![CDATA[gimp]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[oneiric]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://duq.ca/duqamuq/?p=406</guid>
		<description><![CDATA[I&#8217;m creating some business cards and my print shop needs PDF format output with a CMYK colour profile. Neither of these can be done with the Gimp as installed, so this is what I had to do in Ubuntu Oneiric Ocelot with Gimp 2.6.11 to finish the task: 1) install gimp-plugin-registry and icc-profiles from the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m creating some business cards and my print shop needs PDF format output with a CMYK colour profile.  Neither of these can be done with the Gimp as installed, so this is what I had to do in Ubuntu Oneiric Ocelot with Gimp 2.6.11 to finish the task:</p>
<p>1) install gimp-plugin-registry and icc-profiles from the apt repository (&#8220;sudo apt-get install gimp-plugin-registry icc-profiles&#8221; or use the software centre);<br />
2) open the image I want to send to the print shop and select &#8220;Image/Flatten Image&#8221; (if the image has multiple layers) and then &#8220;Image/Separate/Separate&#8221;;<br />
3) in the dialog, accept the default options, but optionally check &#8220;Make CMYK pseudo-composite&#8221; (this doesn&#8217;t seem to affect the final product, but it does generate an image with the colour layers blended in a way that is recognizable &#8212; that way you can see that you are getting what you expect);<br />
4) when the new separated version of the image pops up in a new window, select &#8220;Image/Separate/Export&#8230;&#8221; and save as a TIF file;<br />
5) use &#8220;tiff2pdf filename.tif -o filename.pdf&#8221; to create the pdf file for the printer.</p>
<p>The most useful info I found on this topic was here: <a href="https://wiki.archlinux.org/index.php/CMYK_support_in_The_GIMP#CMYK_color_and_The_GIMP" title="https://wiki.archlinux.org/index.php/CMYK_support_in_The_GIMP" target="_blank">https://wiki.archlinux.org/index.php/CMYK_support_in_The_GIMP</a> and <a href="http://ian-pullen.suite101.com/how-to-save-cmyk-images-in-gimp-a107979" title="http://ian-pullen.suite101.com/how-to-save-cmyk-images-in-gimp-a107979" target="_blank">http://ian-pullen.suite101.com/how-to-save-cmyk-images-in-gimp-a107979</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://duq.ca/duqamuq/?feed=rss2&#038;p=406</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Canon Vixia HV40 HDV Format Notes</title>
		<link>http://duq.ca/duqamuq/?p=400</link>
		<comments>http://duq.ca/duqamuq/?p=400#comments</comments>
		<pubDate>Sat, 04 Sep 2010 02:29:28 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[video]]></category>
		<category><![CDATA[canon HV40]]></category>
		<category><![CDATA[cinelerra]]></category>

		<guid isPermaLink="false">http://duq.ca/duqamuq/?p=400</guid>
		<description><![CDATA[So far I have always converted my HDV footage to NTSC before editing. For a small project I&#8217;m working on now, I&#8217;ve decided to try working directly with the raw HDV footage. This thread explains why my m2t files show up as 1440&#215;1080 even though they can be edited as 1920&#215;1080 (aka 1080i). It has [...]]]></description>
			<content:encoded><![CDATA[<p>So far I have always converted my HDV footage to NTSC before editing.  For a small project I&#8217;m working on now, I&#8217;ve decided to try working directly with the raw HDV footage.</p>
<p><a href="http://www.dvinfo.net/forum/high-definition-video-editing-solutions/86473-why-do-my-1440x1080-clips-look-exactly-same-output-1920x1080.html">This thread</a> explains why my m2t files show up as 1440&#215;1080 even though they can be edited as 1920&#215;1080 (aka 1080i).  It has to do with square vs. rectangular pixels &#8212; or something &#8212; it doesn&#8217;t really matter.  More general info on formats is <a href="http://en.wikipedia.org/wiki/Category:Video_formats">here</a>.</p>
<p>In Cinelerra, you must set the project format to 1440&#215;1080, 16:9 ratio, then make sure you select &#8220;match output size&#8221; by right-clicking on the video track(s).  This looks okay in the compositor window in Cinelerra, but the resulting file plays by default at 4:3 aspect ratio.  You can set this manually when you open the video in VLC and see that everything looks okay.  The only method I have found so far for getting the rendered video to play as 16:9 by default is by using a command such as this on to re-encode it after the fact:</p>
<div class="code-box">ffmpeg -i full_render_test.mov -aspect 16:9 -sameq full_render_test_16-9.mov</div>
<p>For rendering in various formats, follow the instructions <a href="http://crazedmuleproductions.blogspot.com/2007/06/beginners-guide-to-exporting-video-from.html">here</a> as usual.</p>
]]></content:encoded>
			<wfw:commentRss>http://duq.ca/duqamuq/?feed=rss2&#038;p=400</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Smugmug as a Photo Backup Location</title>
		<link>http://duq.ca/duqamuq/?p=393</link>
		<comments>http://duq.ca/duqamuq/?p=393#comments</comments>
		<pubDate>Sat, 03 Apr 2010 18:11:46 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[command line]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[photo managers]]></category>
		<category><![CDATA[smugmug]]></category>

		<guid isPermaLink="false">http://duq.ca/duqamuq/?p=393</guid>
		<description><![CDATA[I&#8217;ve finally gotten around to uploading my photo collection. I&#8217;ve decided to pay for a subscription to Smugmug.com and so far I&#8217;m happy with it. I chose not to use Flickr or other options because I wanted a site which I could use as a private one-to-one backup of my personal store of photos. I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally gotten around to uploading my photo collection.  I&#8217;ve decided to pay for a subscription to <a href="http://smugmug.com">Smugmug.com</a> and so far I&#8217;m happy with it.  I chose not to use Flickr or other options because I wanted a site which I could use as a private one-to-one backup of my personal store of photos.  I can make albums or photos public using other services or through Smugmug.  I also wanted to be able to synchronize tags and metadata between the on-line store and my digikam-managed local version.  If I ever lose my local copy, I should be able to download a full copy of everything in its original form.  Smugmug appears to be able to do all of that (and has other good features, too).</p>
<p>To do the synchronization, I&#8217;m using the php uploader found <a href="http://3dgo.net/2009/09/24/php-uploader-for-smugmug/">here</a>.  It seems to be working, although I had some trouble at first pointing it at the right directory on my system.  Running the upload program is simple:</p>
<div class="code-box">php /path/to/multi-album-upload.php /path/to/pictures</div>
<p>NOTE: I initially had a little trouble because I was pointing to the wrong level in the hierarchy of my picture directory tree.  The program assumes an arrangement something like this:<br />
<code><br />
home<br />
user<br />
photo_library<br />
category<br />
album<br />
image.jpg<br />
</code></p>
<p>My reading of the instructions implied that you could point to &#8220;/home/user/photo_library/category&#8221; but that doesn&#8217;t work.  You need to point to &#8220;/home/user/photo_library.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://duq.ca/duqamuq/?feed=rss2&#038;p=393</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Video</title>
		<link>http://duq.ca/duqamuq/?p=372</link>
		<comments>http://duq.ca/duqamuq/?p=372#comments</comments>
		<pubDate>Fri, 02 Apr 2010 04:13:14 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[video]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[mplayer]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://duq.ca/duqamuq/?p=372</guid>
		<description><![CDATA[I&#8217;ve been experimenting with video codecs and formats for uploading video to the web (Facebook, Youtube, etc.). Encoding for the Web To make a tiny file, you can encode files this way: ffmpeg -i foo.dv foo.mp4 For better quality output, there are a number of variables you can control. I&#8217;m starting with two assumptions for [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been experimenting with video codecs and formats for uploading video to the web (Facebook, Youtube, etc.).</p>
<h2>Encoding for the Web</h2>
<p>To make a tiny file, you can encode files this way:</p>
<div class="code-box">ffmpeg -i foo.dv foo.mp4</div>
<p>For better quality output, there are a number of variables you can control.  I&#8217;m starting with two assumptions for the time being: I&#8217;m using the h264 codec and my target output format is mp4.  For YouTube, flv would be better.</p>
<div class="code-box">ffmpeg -i  foo.dv -ab 128k -ar 44100 -b 1200k -vc h264 -qscale 1 -s 480&#215;360 foo.mp4</div>
<p>&#8220;-i foo.dv&#8221; just identifies the input file, and the rest of the options apply to the output file.</p>
<p>For my own future benefit, I will break down the options I&#8217;ve used: &#8220;-ab 128k&#8221; is the audio bitrate, &#8220;-ar 44100&#8243; is the audio sampling frequency (44100 is the default anyhow); &#8220;-b 1200k&#8221; is the video bitrate; &#8220;-vc h264&#8243; is the video codec; &#8220;-qscale 1&#8243; sets the video quantizer scale (lower is better quality, use &#8220;-sameq&#8221; for the same quality); &#8220;-s 480&#215;360&#8243; is the target width and height.  All of these variables can be changed to create a higher/lower quality file which is smaller/larger in size.  These settings create a decent output file for people to download, but it will be resampled on uploading to websites for streaming.</p>
<h2>FFMPEG Tricks</h2>
<p>If you just want to do a quick trim of the clip before uploading, I&#8217;ve found this is an easy way to do it.  First play the video:</p>
<div class="code-box">mplayer -osdlevel 3 -menu -loop 0 -dr -ni -framedrop -autosync 30 -msglevel all=0 -really-quiet -nolirc foo.dv</div>
<p>Note the start and end points you want, then run the ffmpeg command with &#8220;-ss NN&#8221; for the starting point in seconds and &#8220;-t NN&#8221; for the duration.  That allows you to trim either the start or end of the clip without having to break out Cinelerra or Kino.  By the way, I&#8217;ve got a pile of switches enabled on mplayer, but the only one that really matters is &#8220;-osdlevel 3&#8243; so you can see the counter.</p>
<p>Some Youtube guidance on formats here: <a href="http://www.google.com/support/youtube/bin/answer.py?answer=132460&amp;safe=off">http://www.google.com/support/youtube/bin/answer.py?answer=132460&amp;safe=off</a></p>
<p><a href="http://www.facebook.com/help/?faq=14477">Facebook format</a> details are found here.  You could use this command and vary the qscale and bitrate to get a reasonable file size:</p>
<div class="code-box">ffmpeg -i foo.dv -acodec libfaac -ab 128k -b 1200k -vc h264 -qscale 6 foo.mp4</div>
<p><a href="http://vimeo.com/help/compression">Vimeo format recommendations</a> give specific values for bit rates and codecs as follows for high quality:</p>
<div class="code-box">ffmpeg -i foo.dv -acodec libfaac -ab 320k -b 2000k -vc h264 -sameq  foo.mp4</div>
<p>For HD video on Vimeo:</p>
<div class="code-box">ffmpeg -i foo.m2t -acodec libfaac -ab 320k -b 3000k -vc h264 -sameq -s hd720 foo.mp4</div>
<p>&#8220;-s hd720&#8243; tells ffmpeg to create 1280&#215;720 output.</p>
<h2>Sources of Information</h2>
<p>This video is a good ffmpeg intro: <a href="http://www.linuxjournal.com/video/linux-howto-video-editing-magic-ffmpeg">http://www.linuxjournal.com/video/linux-howto-video-editing-magic-ffmpeg</a></p>
<p>For Youtube uploads, they use the following command.  The presenter explains that these parameters are good for Youtube because they will not be re-encoded on upload:</p>
<div class="code-box">ffmpeg -i foo.mov -ar 22050 -acodec libmp3lame -ab 32k -r 25 -s 320&#215;240 -vcodec flv -qscale 9.5 foo.flv</div>
<p>He also shows how to crop and letterbox using ffmpeg and even creates a moving spotlight.  He also uses the &#8220;-loop_input&#8221; ffmpeg switch in order to make a 10 second clip of a still frame.  Very handy!</p>
<div class="code-box">ffmpeg -loop_input -i still.png -t 10 -r 29.97 -qscale 2 extendedstill.mpg</div>
<p><a href="http://polishlinux.org/linux/ubuntu/screencasts-in-ubuntu-part-2/">Here</a> is an explanation of how to use ffmpeg for screencasting.</p>
]]></content:encoded>
			<wfw:commentRss>http://duq.ca/duqamuq/?feed=rss2&#038;p=372</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extract Audio Track from a Video File</title>
		<link>http://duq.ca/duqamuq/?p=364</link>
		<comments>http://duq.ca/duqamuq/?p=364#comments</comments>
		<pubDate>Wed, 24 Feb 2010 04:36:51 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[video]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[mplayer]]></category>

		<guid isPermaLink="false">http://duq.ca/duqamuq/?p=364</guid>
		<description><![CDATA[I needed to isolate the audio track from an HDV video I captured from my camera. This command worked great: mplayer -dumpaudio video.m2t -dumpfile audio.mp3 as discussed here: http://linux.byexamples.com/archives/229/extract-audio-from-video-or-online-stream/ UPDATE: To extract wav audio data from a dv file, I had to use this command: ffmpeg -i video.dv -vn -acodec copy audio.wav Details here: http://www.tuxradar.com/content/ffmpeg-made-easy]]></description>
			<content:encoded><![CDATA[<p>I needed to isolate the audio track from an HDV video I captured from my camera.  This command worked great:</p>
<div class="code-box">mplayer -dumpaudio video.m2t -dumpfile audio.mp3
</div>
<p>as discussed here: <a href="http://linux.byexamples.com/archives/229/extract-audio-from-video-or-online-stream/">http://linux.byexamples.com/archives/229/extract-audio-from-video-or-online-stream/</a></p>
<p>UPDATE: To extract wav audio data from a dv file, I had to use this command:</p>
<div class="code-box">ffmpeg -i video.dv -vn -acodec copy audio.wav
</div>
<p>Details here: <a href="http://www.tuxradar.com/content/ffmpeg-made-easy">http://www.tuxradar.com/content/ffmpeg-made-easy</a></p>
]]></content:encoded>
			<wfw:commentRss>http://duq.ca/duqamuq/?feed=rss2&#038;p=364</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Video Production on Linux Workshop</title>
		<link>http://duq.ca/duqamuq/?p=356</link>
		<comments>http://duq.ca/duqamuq/?p=356#comments</comments>
		<pubDate>Thu, 17 Dec 2009 00:07:58 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://duq.ca/duqamuq/?p=356</guid>
		<description><![CDATA[I&#8217;m putting on a workshop/demo this evening to introduce some people to open source software and Linux for video editing. Here are the handouts: linux_video. Thanks to Western Arctic Moving Pictures for hosting the workshop!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m putting on a workshop/demo this evening to introduce some people to open source software and Linux for video editing.  Here are the handouts: <a rel="attachment wp-att-357" href="http://duq.ca/duqamuq/?attachment_id=357">linux_video</a>.</p>
<p>Thanks to Western Arctic Moving Pictures for hosting the workshop!</p>
]]></content:encoded>
			<wfw:commentRss>http://duq.ca/duqamuq/?feed=rss2&#038;p=356</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scripts for Monkeying with Cinelerra XML</title>
		<link>http://duq.ca/duqamuq/?p=340</link>
		<comments>http://duq.ca/duqamuq/?p=340#comments</comments>
		<pubDate>Mon, 30 Nov 2009 20:53:13 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cinelerra]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://duq.ca/duqamuq/?p=340</guid>
		<description><![CDATA[I&#8217;ve moved my Cinelerra projects from one directory path to another and scrambled a few things in the process. I&#8217;ve written a few bash scripts which helped me sort things out. In the process, I&#8217;ve learned a bit about the xml format which Cinelerra uses to store references to files and edits. When you add [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve moved my Cinelerra projects from one directory path to another and scrambled a few things in the process.  I&#8217;ve written a few bash scripts which helped me sort things out.</p>
<p>In the process, I&#8217;ve learned a bit about the xml format which Cinelerra uses to store references to files and edits.  When you add a resource, it appears twice between opening and closing &#8220;ASSET&#8221; tags with the format &lt;ASSET SRC=&#8221;/path/to/filename&#8221;&gt;[asset details]&lt;/ASSET&gt;.  Then every time you include that file in a track of your project, the filename appears again in an &#8220;EDIT&#8221; tag complex in the format &lt;FILE SRC=&#8221;/path/to/filename&#8221;&gt;[edit details]&lt;/FILE&gt;</p>
<p>First, I needed to check the paths for all the resources in the file to make sure they are still valid.  I called this program <a href="http://duq.ca/duqamuq/?p=343">test_xml_paths.sh</a>.  I corrected the incorrect paths with a text editor, but found that Cinelerra was still crashing with a memory error when I loaded the project.</p>
<p>Second, I decided to find and eliminate all of the unused assets in the file.  I originally had a forty minute video in one file, but some time ago I split the project into four ten minute chunks.  When I created the original project, I had added a couple of thousands of clips for possible inclusion, so now that I&#8217;m working on the final cut, I don&#8217;t need all that bloat.  </p>
<p>I created a function to figure out which assets were being used in the edit list and which were not: <a href="http://duq.ca/duqamuq/?p=345">list_unused_assets.sh</a>.</p>
<p>Finally, I wrote a script which would recreate a new xml project file with all the redundant assets removed: <a href="http://duq.ca/duqamuq/?p=346">remove_unused_assets.sh</a>.</p>
<p>I can&#8217;t offer any warranty on these scripts, of course, but I hope they may help somebody else.  If nothing else, there&#8217;s a great example of multi-line sed editing in the last one.</p>
]]></content:encoded>
			<wfw:commentRss>http://duq.ca/duqamuq/?feed=rss2&#038;p=340</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove Unused Assets from a Cinelerra XML Project File</title>
		<link>http://duq.ca/duqamuq/?p=346</link>
		<comments>http://duq.ca/duqamuq/?p=346#comments</comments>
		<pubDate>Mon, 30 Nov 2009 20:44:03 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cinelerra]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://duq.ca/duqamuq/?p=346</guid>
		<description><![CDATA[This is a bash script to remove all the unwanted assets from a Cinelerra project XML file. I needed it to cut out bloat from a project I was working on which had hundreds of unused resources after I split the project up into ten minute chunks. Doing so stopped Cinelerra from crashing when I [...]]]></description>
			<content:encoded><![CDATA[<p>This is a bash script to remove all the unwanted assets from a Cinelerra project XML file.  I needed it to cut out bloat from a project I was working on which had hundreds of unused resources after I split the project up into ten minute chunks.  Doing so stopped Cinelerra from crashing when I loaded the project: YMMV.</p>
<p>Save this script as &#8220;remove_unused_assets.sh&#8221;.  It needs the function in &#8220;list_unused_assets.sh&#8221; which I posted <a href="http://duq.ca/duqamuq/?p=345">here</a>.</p>
<div class="code-box">
#! /bin/bash<br />
#kk remove_unused_assets.sh<br />
#kk<br />
#kk For cinelerra xml files<br />
#kk this script removes the contents of asset tags which are not also used for edits</p>
<p>if [ -z "$1" -o "$1" = "-h" ]<br />
then<br />
    echo &#8220;Usage: remove_unused_assets [xml_filename]&#8220;<br />
    echo &#8220;For cinelerra xml files, this script removes the contents of asset tags which are not being used for edits&#8221;<br />
    exit<br />
fi</p>
<p>TMPDIR=&#8221;/tmp&#8221;<br />
SCRIPTDIR=&#8221;$HOME/Video/video_new/common/scripts&#8221;</p>
<p>. $SCRIPTDIR/list_unused_assets.sh<br />
. $SCRIPTDIR/include.inc</p>
<p>#assign the parameter to a variable<br />
XMLFILE=$1</p>
<p>#location of the temporary files<br />
ASSETS_FILE=&#8221;$TMPDIR/ASSETS_FILE&#8221;<br />
EDITS_FILE=&#8221;$TMPDIR/EDITS_FILE&#8221;<br />
XMLFILE_NEW=&#8221;$1&#8243;_new<br />
XMLFILE_TMP=&#8221;$TMPDIR/XMLFILE_TMP&#8221;</p>
<p>#check if the xml file exists and exit if it does not<br />
if [ ! -e $XMLFILE ]; then error &#8220;XML file does not exist&#8221;; fi</p>
<p>list_unused_assets $XMLFILE<br />
if [ $? != 0 ] ; then error &#8220;list_unused_assets failed&#8221;; fi</p>
<p>cp $XMLFILE $XMLFILE_TMP</p>
<p>echo<br />
echo Removing Unused Assets&#8230;<br />
echo<br />
echo &#8220;Working&#8230;&#8221;<br />
echo</p>
<p># loop through the list of unused assets and remove the ASSET tag lines for each<br />
# sed command from here: http://ilfilosofo.com/blog/2008/04/26/sed-multi-line-search-and-replace/</p>
<p>for f in $( comm -23 $ASSETS_FILE $EDITS_FILE ); do</p>
<p>#to make the filename string work in sed, I have to escape all of the periods and slashes<br />
FORMATTED_f=`echo &#8220;$f&#8221; | sed -e &#8216;s:\/:\\\/:g&#8217; -e &#8216;s:\.:\\\.:g&#8217;`</p>
<p>#this complicated sed script came from the sed FAQ: http://sed.sourceforge.net/sedfaq4.html#s4.21<br />
#in order to make the variable substitution work, I had to close the sed script with a single quote<br />
#then enclose the variable in double quotes, then re-open the sed script with a single quote<br />
#the -i option is for editing a file &#8220;in place&#8221;<br />
sed -i -e &#8216;<br />
# sed script to delete a block if /regex/ matches inside it<br />
     :Top<br />
     /\<ASSET SRC/,/\/ASSET\>/ {    # For each line between these block markers..<br />
        /\/ASSET\>/!{         #   If we are not at the /end/ marker<br />
           $!{          #     nor the last line of the file,<br />
              N;        #     add the Next line to the pattern space<br />
              b Top<br />
           }            #   and branch (loop back) to the :Top label.<br />
        }               # This line matches the /end/ marker.<br />
        /&#8217;&#8221;$FORMATTED_f&#8221;&#8216;/d;       # If /regex/ matches, delete the block.<br />
}                  # Otherwise, the block will be printed.<br />
#&#8212;end of script&#8212;<br />
&#8216; $XMLFILE_TMP</p>
<p>#diff $XMLFILE $XMLFILE_TMP</p>
<p>echo -n &#8216;                                                                                                                                   \r&#8217;<br />
echo -n $f&#8217;\r&#8217;</p>
<p>done</p>
<p>cp $XMLFILE_TMP $XMLFILE_NEW</p>
<p>echo<br />
list_unused_assets $XMLFILE_NEW</p>
<p>echo<br />
echo Finished.<br />
echo<br />
echo The new version of the xml file has been saved as $XMLFILE_NEW.<br />
echo
</p></div>
<p>This program depends on include.inc which contains the following:</p>
<div class="code-box">
#!/bin/bash</p>
<p>#use colour in the output just for fun<br />
GREEN=$(printf &#8220;\033[32m&#8221;)<br />
RED=$(printf &#8220;\033[31m&#8221;)<br />
NC=$(printf &#8220;\033[0m&#8221;)</p>
<p>error()<br />
{<br />
echo ERROR: $1<br />
exit 1<br />
}
</p></div>
<p>I tried to make these scripts as tidy and portable as possible &#8212; you will, however, need to change the path for $SCRIPTDIR to the location you are using (and $TMPDIR if you don&#8217;t want to put your temporary files in /tmp).</p>
]]></content:encoded>
			<wfw:commentRss>http://duq.ca/duqamuq/?feed=rss2&#038;p=346</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>List Unused Assets in a Cinelerra XML Project File</title>
		<link>http://duq.ca/duqamuq/?p=345</link>
		<comments>http://duq.ca/duqamuq/?p=345#comments</comments>
		<pubDate>Mon, 30 Nov 2009 20:39:56 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cinelerra]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://duq.ca/duqamuq/?p=345</guid>
		<description><![CDATA[This is a bash script which contains a function used to figure out which assets in a Cinelerra project are not required for the edit list. I created it because I had pulled in a couple of thousand media resources for a project and wanted to eliminate bloat. I moved the project and found it [...]]]></description>
			<content:encoded><![CDATA[<p>This is a bash script which contains a function used to figure out which assets in a Cinelerra project are not required for the edit list.  I created it because I had pulled in a couple of thousand media resources for a project and wanted to eliminate bloat.  I moved the project and found it kept crashing on me until I eliminated the crud.  I wrote another program to call this function and then actually clean out the xml.  <a href="http://duq.ca/duqamuq/?p=346">You can view &#8220;remove_unused_assets.sh&#8221; here</a>.</p>
<p>Running this script doesn&#8217;t do anything until you call the enclosed function.  This function can be called from the command line with:</p>
<div class="code-box">
. list_unused_assets.sh;list_unused_assets <filename>
</div>
<div class="code-box">
#! /bin/bash<br />
#kk list_unused_assets.sh<br />
#kk<br />
#kk check a cinelerra xml file to see which assets have been loaded, but not used in the project<br />
#kk provide filename to check as parameter<br />
#kk from the command line, type &#8220;. list_unused_assets.sh;list_unused_assets <filename>&#8220;</p>
<p>list_unused_assets()<br />
{</p>
<p>SCRIPTDIR=&#8221;$HOME/Video/video_new/common/scripts&#8221;<br />
TMPDIR=&#8221;/tmp&#8221;</p>
<p>. $SCRIPTDIR/include.inc</p>
<p>#location of the temporary files<br />
ASSETS_FILE=&#8221;$TMPDIR/ASSETS_FILE&#8221;<br />
EDITS_FILE=&#8221;$TMPDIR/EDITS_FILE&#8221;</p>
<p>#assign the parameter to a variable<br />
XMLFILE=$1</p>
<p>#check if the xml file exists and exit if it does not<br />
if [ ! -e $XMLFILE ]; then error &#8220;XML file does not exist&#8221;; fi</p>
<p>#if the temp file exists, delete it<br />
if [ -e $ASSETS_FILE ]; then<br />
    rm $ASSETS_FILE<br />
fi</p>
<p>if [ -e $EDITS_FILE ]; then<br />
    rm $EDITS_FILE<br />
fi</p>
<p>echo<br />
echo Checking $XMLFILE for assets unused by the project&#8230;<br />
echo</p>
<p>#find all of the filenames in the xml file and strip the extra junk<br />
grep -E &#8220;ASSET SRC=&#8221; $XMLFILE | sed -e &#8216;s/^.*SRC=&#8221;//g&#8217; -e &#8216;s/&#8221;>.*$//g&#8217; | sort | uniq > $ASSETS_FILE<br />
grep -E &#8220;FILE SRC=&#8221; $XMLFILE | sed -e &#8216;s/^.*SRC=&#8221;//g&#8217; -e &#8216;s/&#8221;>.*$//g&#8217; | sort | uniq > $EDITS_FILE</p>
<p>#output the counts<br />
echo `grep -E &#8220;ASSET SRC=|FILE SRC=&#8221; $XMLFILE | sed -e &#8216;s/^.*SRC=&#8221;//g&#8217; -e &#8216;s/&#8221;>.*$//g&#8217; | sort | uniq | wc -l` Total Assets<br />
echo $RED`comm -23 $ASSETS_FILE $EDITS_FILE | wc -l` Unused Assets$NC<br />
echo $GREEN`comm -12 $ASSETS_FILE $EDITS_FILE | wc -l` Used Assets$NC</p>
<p>}
</p></div>
<p>This program depends on include.inc which contains the following:</p>
<div class="code-box">
#!/bin/bash</p>
<p>#use colour in the output just for fun<br />
GREEN=$(printf &#8220;\033[32m&#8221;)<br />
RED=$(printf &#8220;\033[31m&#8221;)<br />
NC=$(printf &#8220;\033[0m&#8221;)</p>
<p>error()<br />
{<br />
echo ERROR: $1<br />
exit 1<br />
}
</p></div>
<p>I tried to make these scripts as tidy and portable as possible &#8212; you will, however, need to change the path for $SCRIPTDIR to the location you are using (and $TMPDIR if you don&#8217;t want to put your temporary files in /tmp).</p>
]]></content:encoded>
			<wfw:commentRss>http://duq.ca/duqamuq/?feed=rss2&#038;p=345</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Test File Paths in a Cinelerra XML File</title>
		<link>http://duq.ca/duqamuq/?p=343</link>
		<comments>http://duq.ca/duqamuq/?p=343#comments</comments>
		<pubDate>Mon, 30 Nov 2009 20:33:51 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cinelerra]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://duq.ca/duqamuq/?p=343</guid>
		<description><![CDATA[This is a bash script to test all the filenames and paths in a Cinelerra project to make sure they are still valid. #!/bin/bash #kk test_xml_paths.sh #kk #kk check a cinelerra xml file to make sure the file references are all valid #kk provide filename to check as parameter if [ -z "$1" -o "$1" [...]]]></description>
			<content:encoded><![CDATA[<p>This is a bash script to test all the filenames and paths in a Cinelerra project to make sure they are still valid.</p>
<div class="code-box">
#!/bin/bash<br />
#kk test_xml_paths.sh<br />
#kk<br />
#kk check a cinelerra xml file to make sure the file references are all valid<br />
#kk provide filename to check as parameter</p>
<p>if [ -z "$1" -o "$1" = "-h" ]<br />
then<br />
    echo &#8220;Usage: test_xml_paths [xml_filename]&#8220;<br />
    echo &#8220;For cinelerra xml files, this script checks that file paths are valid&#8221;<br />
    exit<br />
fi</p>
<p>SCRIPTDIR=&#8221;$HOME/Video/video_new/common/scripts&#8221;<br />
TMPDIR=&#8221;/tmp&#8221;</p>
<p>. $SCRIPTDIR/include.inc</p>
<p>#assign the parameter to a variable<br />
XMLFILE=$1</p>
<p>#check if the xml file exists and exit if it does not<br />
if [ ! -e $XMLFILE ]; then error &#8220;XML file does not exist&#8221;; fi</p>
<p>#location of the temporary file<br />
FILENAMES=&#8221;$TMPDIR/TEST_XML_PATHS&#8221;</p>
<p>#set counters to zero<br />
GOODCOUNT=0<br />
BADCOUNT=0</p>
<p>#if the temp file exists, delete it<br />
if [ -e $FILENAMES ]; then<br />
    rm $FILENAMES<br />
fi</p>
<p>echo<br />
echo Checking $XMLFILE for valid file paths&#8230;<br />
echo</p>
<p>#find all of the filenames in the xml file and strip the extra junk<br />
#send the output to a file<br />
grep -E &#8220;SRC=|PATH=&#8221; $XMLFILE | sed -e &#8216;s/^.*SRC=&#8221;//g&#8217;  -e &#8216;s/^.*PATH=&#8221;//g&#8217; -e &#8216;s/&#8221;>.*$//g&#8217; > $FILENAMES<br />
if [ $? != 0 ] ; then error &#8220;grep failed&#8221;; fi</p>
<p># loop through the output and test if the filename is either a link or a file<br />
for f in $( cat $FILENAMES ); do<br />
   if [ ! -h $f -a ! -e $f ]; then<br />
       BADCOUNT=`expr $BADCOUNT + 1`<br />
       echo ERROR: Missing $f<br />
   else<br />
       GOODCOUNT=`expr $GOODCOUNT + 1`<br />
   fi<br />
done</p>
<p>#output the counts<br />
echo<br />
echo $RED$BADCOUNT Total Bad Pathss $NC<br />
echo $GREEN$GOODCOUNT Total Good Paths$NC<br />
echo
</p></div>
<p>This program depends on include.inc which contains the following:</p>
<div class="code-box">
#!/bin/bash</p>
<p>#use colour in the output just for fun<br />
GREEN=$(printf &#8220;\033[32m&#8221;)<br />
RED=$(printf &#8220;\033[31m&#8221;)<br />
NC=$(printf &#8220;\033[0m&#8221;)</p>
<p>error()<br />
{<br />
echo ERROR: $1<br />
exit 1<br />
}
</p></div>
<p>I tried to make these scripts as tidy and portable as possible &#8212; you will, however, need to change the path for $SCRIPTDIR to the location you are using (and $TMPDIR if you don&#8217;t want to put your temporary files in /tmp).</p>
]]></content:encoded>
			<wfw:commentRss>http://duq.ca/duqamuq/?feed=rss2&#038;p=343</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

