<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";}
span.EmailStyle19
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<pre><span style="font-family:"Calibri","sans-serif"">Fellow LUG’ers,<o:p></o:p></span></pre>
<pre><span style="font-family:"Calibri","sans-serif""><o:p> </o:p></span></pre>
<pre><span style="font-family:"Calibri","sans-serif"">I have a simple perl script (below) used to assemble MnDOT traffic animations, long-term weather patterns, security camera images, etc. It’s worked well for over 8 years running on different hardware and various linux distros. <o:p></o:p></span></pre>
<pre><span style="font-family:"Calibri","sans-serif""><o:p> </o:p></span></pre>
<pre><span style="font-family:"Calibri","sans-serif"">Calls to ffmpeg create png files with normal 644 permissions, but mpeg files now get created with 600 (–rw --- ----). It didn’t use to work that way when </span>mpeg2encode was used. <span style="font-family:"Calibri","sans-serif"">I have this issue on Red Hat Enterprise Linux Server release 5.8 (Tikanga) and a two year old Debian install.<o:p></o:p></span></pre>
<pre><span style="font-family:"Calibri","sans-serif""><o:p> </o:p></span></pre>
<pre><span style="font-family:"Calibri","sans-serif"">Why the change? How can I restore the earlier behavior? Setting umask to 022 within the script doesn’t work, but I can chmod files at the end.<o:p></o:p></span></pre>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m serving the mpegs from Apache and viewing with a browser plug in (QuickTime). They now appear “sticky” and “jerky.” Older mpegs, created with the previous system, playback fine so the problem is not with Apache, browser, or plug-in.
Newly created files are also much smaller (1.3M) compared to before (11M) , so I suspect the authors also chose a lower mpeg quality setting.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is there an mpeg quality setting available in Image::Magick?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Here’s my script.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#! /usr/bin/perl<o:p></o:p></p>
<p class="MsoNormal"># @(#) animate.pl - Craig A. Smith 2003-10-17<o:p></o:p></p>
<p class="MsoNormal"># Reads a series of images and writes an animation<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"># doesn't work: umask(022);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">$sourcedir="/var/www/doggiecam/cam21";<o:p></o:p></p>
<p class="MsoNormal">$cameraname="back";<o:p></o:p></p>
<p class="MsoNormal">$outputdir="/var/www/doggiecam/animations";<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">use Image::Magick;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#### delete jpegs after 2 days<o:p></o:p></p>
<p class="MsoNormal">## find truncates fractions of 24 hrs periods, so +1 only matches after 2 days<o:p></o:p></p>
<p class="MsoNormal">system (rm -f `find $sourcedir -mtime +1 `);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">$date = `date -I`;<o:p></o:p></p>
<p class="MsoNormal">chomp $date;<o:p></o:p></p>
<p class="MsoNormal">my($image, $x);<o:p></o:p></p>
<p class="MsoNormal">$image = Image::Magick->new;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#### get all jpg files<o:p></o:p></p>
<p class="MsoNormal">$x = $image->Read("$sourcedir/*.jpg");<o:p></o:p></p>
<p class="MsoNormal">warn "$x" if "$x";<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">##### Write mpeg <o:p></o:p></p>
<p class="MsoNormal"># #$x = $image->Resize(geometry=>'600x600');<o:p></o:p></p>
<p class="MsoNormal">$x = $image->Write("$outputdir/$date.$cameraname.mpeg");<o:p></o:p></p>
<p class="MsoNormal">warn "$x" if "$x";<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">##################################################################<o:p></o:p></p>
<p class="MsoNormal"># Example from <a href="http://www.imagemagick.org/www/perl.html#exam">
www.imagemagick.org/www/perl.html#exam</a> (no longer found)<o:p></o:p></p>
<p class="MsoNormal"># reads three images, crops them, and writes a GIF animation sequence<o:p></o:p></p>
<p class="MsoNormal">#<o:p></o:p></p>
<p class="MsoNormal"># use Image::Magick;<o:p></o:p></p>
<p class="MsoNormal"># my($image, $x);<o:p></o:p></p>
<p class="MsoNormal"># $image = Image::Magick->new;<o:p></o:p></p>
<p class="MsoNormal"># $x = $image->Read('girl.png', 'logo.png', 'rose.png');<o:p></o:p></p>
<p class="MsoNormal"># warn "$x" if "$x";<o:p></o:p></p>
<p class="MsoNormal"># $x = $image->Crop(geometry=>'100x100"+100"+100');<o:p></o:p></p>
<p class="MsoNormal"># warn "$x" if "$x";<o:p></o:p></p>
<p class="MsoNormal"># $x = $image->Write('x.png');<o:p></o:p></p>
<p class="MsoNormal"># warn "$x" if "$x";<o:p></o:p></p>
<p class="MsoNormal">##################################################################<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>