element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Problem running MENCODER or AVCONV from Cron
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 3 replies
  • Subscribers 676 subscribers
  • Views 625 views
  • Users 0 members are here
  • cron
  • problem
  • raspberry_pi
  • raspberry-pi
  • avconv
  • mencoder
Related

Problem running MENCODER or AVCONV from Cron

mikedavis
mikedavis over 10 years ago

I have a project where my Raspberry Pi starts taking pictures at 4:30AM and stops at 7:30AM everyday.  Then MENCODER or AVCONV should turn on to stitch them together into a movie.  Then a Dropbox Uploader uploads the movie to my dropbox account, and another process deletes all of the pictures.

 

The only one of those that is not working is the MENCODER or AVCONV portion.

 

I started out using MENCODER, and it works just fine when I use it in the terminal.  However, when I put it in Cron, it makes a movie with just one frame and then quits.  Apparently it is a known problem and this was posted to get around it.  I was not able to make the MAILTO solution work.  I guess I don't know where it goes in my Crontab file.

 

I moved to using AVCONV, and again it works just fine in the terminal.  However, when I put it in Cron as a scheduled task, nothing seems to happen.  The time when it is supposed to kick on comes and goes, and there is no sign of a movie file.  I searched and didn't find any kind of common problem with AVCONV.

 

This is my bash script for making the movie with MENCODER

#!/bin/bash

 

 

DATE=$(date +"%F")

ls *.jpg > stills.txt

mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o /home/pi/camera/$DATE.avi -mf type=jpeg:fps=17 mf://@stills.txt

 

This is my bash script for making the movie with AVCONV.

 

#!/bin/bash

DATE=$(date +"%Y%m%d")

avconv -r 10 -i frame_%04d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 $DATE.mp4

 

This is my crontab file

 

30 4 * * * python /home/pi/camera/camera.py &
35 7 * * * /home/pi/camera/avconv.sh 2>&1
35 10 * * * python /home/pi/upload.py &
35 11 * * * python /home/pi/clearpic.py &

 

Any assistance would be greatly appreciated.  As I mentioned, everything else works, and this is the one part that is keeping me from installing my project at a school.

 

Thank you!

  • Sign in to reply
  • Cancel
Parents
  • clem57
    0 clem57 over 10 years ago

    Try to include redirection like < for input and > for output.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • clem57
    0 clem57 over 10 years ago

    Try to include redirection like < for input and > for output.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube