Can't you just put a chmod in the script?

On Wed, 18 Jul 2012, Smith, Craig A wrote:

> 
> Fellow LUG’ers,
> 
>  
> 
> I have a simple perl script (below) used to assemble MnDOT traffic animation
> s, long-term weather patterns, security camera images, etc.  It’s worked wel
> l for over 8 years running on different hardware and various linux distros. 
> 
> 
>  
> 
> 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 w
> hen mpeg2encode was used.  I have this issue on Red Hat Enterprise Linux Ser
> ver release 5.8 (Tikanga) and a two year old Debian install.
> 
>  
> 
> Why the change?  How can I restore the earlier behavior?  Setting umask to 0
> 22 within the script doesn’t work, but I can chmod files at the end.
> 
>  
> 
> 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.
> 
>  
> 
> Is there an mpeg quality setting available in Image::Magick?
> 
>  
> 
> Here’s my script.
> 
>  
> 
> #! /usr/bin/perl
> 
> # @(#) animate.pl - Craig A. Smith 2003-10-17
> 
> # Reads a series of images and writes an animation
> 
>  
> 
> # doesn't work: umask(022);
> 
>  
> 
> $sourcedir="/var/www/doggiecam/cam21";
> 
> $cameraname="back";
> 
> $outputdir="/var/www/doggiecam/animations";
> 
>  
> 
> use Image::Magick;
> 
>  
> 
> ####  delete jpegs after 2 days
> 
> ## find truncates fractions of 24 hrs periods, so +1 only matches after 2
> days
> 
> system (rm -f `find $sourcedir  -mtime +1 `);
> 
>  
> 
> $date = `date -I`;
> 
> chomp $date;
> 
> my($image, $x);
> 
> $image = Image::Magick->new;
> 
>  
> 
> #### get all jpg files
> 
> $x = $image->Read("$sourcedir/*.jpg");
> 
> warn "$x" if "$x";
> 
>  
> 
> ##### Write mpeg
> 
> # #$x = $image->Resize(geometry=>'600x600');
> 
> $x = $image->Write("$outputdir/$date.$cameraname.mpeg");
> 
> warn "$x" if "$x";
> 
>  
> 
>  
> 
> ##################################################################
> 
> # Example from www.imagemagick.org/www/perl.html#exam (no longer found)
> 
> #  reads three images, crops them, and writes a GIF animation sequence
> 
> #
> 
> # use Image::Magick;
> 
> # my($image, $x);
> 
> # $image = Image::Magick->new;
> 
> # $x = $image->Read('girl.png', 'logo.png', 'rose.png');
> 
> # warn "$x" if "$x";
> 
> # $x = $image->Crop(geometry=>'100x100"+100"+100');
> 
> # warn "$x" if "$x";
> 
> # $x = $image->Write('x.png');
> 
> # warn "$x" if "$x";
> 
> ##################################################################
> 
>  
> 
>  
> 
> 
>


-Yaron

--