AllskyTeam / allsky

A Raspberry Pi operated Wireless Allsky Camera
MIT License
1.19k stars 180 forks source link

Timelapse: ffmpeg failed message #1717

Closed ccdanieldb closed 1 year ago

ccdanieldb commented 2 years ago

~/allsky/version

Environment

ffmpeg version 4.3.4-0+deb11u1+rpt3 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10 (Raspbian 10.2.1-6+rpi1)

Bug Description

pi@localhost:~/allsky/scripts $ ./timelapse.sh 20221006

*** : ERROR: ffmpeg failed.
Error log is in '/home/pi/allsky/tmp/timelapseTMP.txt'.

Links in '/home/pi/allsky/tmp/sequence-20221006' left for debugging.
Remove them when the problem is fixed.

#!/bin/bash

# NOTES:
#  - Variable names must start at the beginning of a line.
#  - There should be nothing after a variable's value, i.e., no comments on the same line.
#  - Values can optionally be quoted with double quotes, NOT single quotes.
#  - If a variable occurs multiple times, only the last value is used.

# Choose between "ZWO" or "RPiHQ".
CAMERA="RPiHQ"

########## Images
# Set to "true" to upload the current image to your website.
IMG_UPLOAD="false"

# If IMG_UPLOAD is "true", upload images every IMG_UPLOAD_FREQUENCY frames, e.g., every 5 frames.
# 1 uploades every frame.
IMG_UPLOAD_FREQUENCY=1

# The websites look in IMG_DIR for the current image.
# When using the Allsky website from the "allsky-website" packge,
# "current" is an alias for "/home/pi/allsky".
# If you use the default IMG_DIR and have the Allsky website, set "imageName" in
# /var/www/html/allsky/config.js to:
#     imageName: "/current/tmp/image.jpg",
# This avoids copying the image to the website.
# Only change IMG_DIR if you know what you are doing.
IMG_DIR="current/tmp"

# Resize images before cropping, stretching, and saving.
# Adjust IMG_WIDTH and IMG_HEIGHT according to your camera's sensor ratio.
IMG_RESIZE="false"
IMG_WIDTH=2028
IMG_HEIGHT=1520

# Crop images before stretching and saving.
# This is useful to remove some of the black border when using a fisheye lens.
# If you crop an image you may need to change the "Text X" and/or "Text Y" settings in the WebUI.
CROP_IMAGE="false"
CROP_WIDTH=640
CROP_HEIGHT=480
CROP_OFFSET_X=0
CROP_OFFSET_Y=0

# Auto stretch images saved at night.
AUTO_STRETCH="false"
AUTO_STRETCH_AMOUNT=10
AUTO_STRETCH_MID_POINT="10%"

# Resize uploaded images.  Change the size to fit your sensor.
RESIZE_UPLOADS="false"
RESIZE_UPLOADS_SIZE="962x720"

# Create thumbnails of images.  If you are not running the WebUI consider changing this to "false".
IMG_CREATE_THUMBNAILS="true"

# Remove corrupt images before generating keograms, startrails, and timelapse videos.
# This only adds a few seconds per image as it's being processed.
REMOVE_BAD_IMAGES="true"

# If REMOVE_BAD_IMAGES is "true", images whose mean brightness is
# less than THRESHOLD_LOW or greater than THRESHOLD_HIGH percent (max: 100) will be removed.
# Set to 0 to disable the brightness checks.
REMOVE_BAD_IMAGES_THRESHOLD_LOW=1
REMOVE_BAD_IMAGES_THRESHOLD_HIGH=90

# Additional Capture parameters.  Run "capture_RPiHQ -h" to see the options.
# e.g. activate autoexposure algorithm "mean" for RPiHQ: "-nightmean 0.3 -daymean 0.3"
CAPTURE_EXTRA_PARAMETERS=""

# Set to "false" to disable daytime capture.
DAYTIME_CAPTURE="true"

# Night images are always taken and saved to disk.
# Setting DAYTIME_SAVE to "true" also saves daytime images to disk.
# Will only save daytime images if DAYTIME_CAPTURE="true".
DAYTIME_SAVE="true"

########## Timelapse
# Set to "true" to generate a timelapse video at the end of each night.
TIMELAPSE="true"

# Set the resolution of the timelapse video (sizes must be EVEN numbers).
# 0 disables resize and uses the same resolution as the images.
TIMELAPSEWIDTH=0
TIMELAPSEHEIGHT=0

# Bitrate of the timelapse video.  Higher numbers will produce higher quality but larger files.
TIMELAPSE_BITRATE="2000k"

# Timelapse video Frames Per Second.
FPS=25

# Encoder for timelapse video. May be changed to use a hardware encoder or different codec.
VCODEC="libx264"

# Pixel format.
PIX_FMT=${PIX_FMT:-yuv420p}

# FFLOG determines the amount of log information displayed while creating a timelapse video.
# Set to "info" to see additional information if you are tuning the algorithm.
FFLOG="warning"

# While creating a timelapse video, a sequence of links to the images is created.
# Set to "true" to keep that sequence; set to "false" to have it deleted when done.
KEEP_SEQUENCE="false"

# Any additional timelapse parameters.  Run "ffmpeg -?" to see the options.
TIMELAPSE_EXTRA_PARAMETERS=""

# Set to "true" to upload timelapse video to your website at the end of each night.
UPLOAD_VIDEO="false"

########## Keogram
# Set to "true" to generate a keogram at the end of each night.
KEOGRAM="true"

# Additional Keogram parameters.  Run "keogram --help" to see the options.
KEOGRAM_EXTRA_PARAMETERS="--font-size 1.0 --font-line 1 --font-color '255 255 255'"

# Set to "true" to upload the keogram to your website at the end of each night.
UPLOAD_KEOGRAM="false"

########## Startrails
# Set to "true" to generate a startrails image of each night.
STARTRAILS="true"

# Images with a brightness higher than this threshold will be skipped for
# startrails image generation.  Values are 0.0 to 1.0.
BRIGHTNESS_THRESHOLD=0.1

# Any additional startrails parameters.  Run "startrails --help" to see the options.
STARTRAILS_EXTRA_PARAMETERS=""

# Set to "true" to upload the startrails image to your website at the end of each night.
UPLOAD_STARTRAILS="false"

########## Other
# Size of thumbnails.
THUMBNAIL_SIZE_X=100
THUMBNAIL_SIZE_Y=75

# Set this value to the number of days images plus videos you want to keep.
# Set to "" to keep ALL days.
DAYS_TO_KEEP=14

# Same as DAYS_TO_KEEP, but for the Allsky website, if installed.
# Set to "" to keep ALL days.
WEB_DAYS_TO_KEEP=""

# Set to "true" to upload data to your server at the end of each night.
# This is needed if you are running the Allsky Website.
POST_END_OF_NIGHT_DATA="false"

# Set to "true" if you want to enable dark frame subtraction on your night-time images.
# You must first create dark frames - see the README.md file for instructions.
DARK_FRAME_SUBTRACTION="false"

# If you have additional data or buttons you want displayed on the WebUI's System page,
# specify one or more colon-separated files that contain that data.
# You must provide scripts to update those files.
# See the WEBUI_DATA_FILES configuration variable in the "Software settings" section of
# https://github.com/thomasjacquin/allsky/wiki/allsky-Settings for details.
WEBUI_DATA_FILES=""

# The uhubctl command can reset the USB bus if the camera isn't found and you know it's there.
# Allsky.sh uses this to try and fix "missing" cameras.
# Specify the path to the command and the USB bus number (on a Pi 4, bus 1 is USB 2.0 and
# bus 2 is the USB 3.0 ports).  If you don't have 'uhubctl' installed set UHUBCTL_PATH="".
UHUBCTL_PATH=""
UHUBCTL_PORT=2

# Path to the camera settings (exposure, gain, delay, overlay, etc) files.
# Do not change unless you know what you are doing.
CAMERA_SETTINGS_DIR="/etc/raspap"

# ================ Do not change anything below this line.
END_OF_USER_SETTINGS="true"     # During upgrades, stop looking for variables here.

if [ "${CAMERA}" = "" ]; then
    echo "${RED}ERROR: Please set CAMERA in config/config.sh${NC}"
    sudo systemctl stop allsky
    exit 100
fi

# COMPATIBILITY CHECK
if [ -z "${DAYS_TO_KEEP}" ]; then       # Old version had AUTO_DELETE and NIGHTS_TO_KEEP
    AUTO_DELETE="false"
else
    AUTO_DELETE="true"
    NIGHTS_TO_KEEP="${DAYS_TO_KEEP}"
fi

# This is needed in case the user changed the default location the current image is saved to.
if [ "${IMG_DIR}" = "current/tmp" ]; then
    CAPTURE_SAVE_DIR="${ALLSKY_TMP}"
else
    CAPTURE_SAVE_DIR="${IMG_DIR}"
fi

CAMERA_SETTINGS="${CAMERA_SETTINGS_DIR}/settings_${CAMERA}.json"

# Get the name of the file the websites will look for, and split into name and extension.
FULL_FILENAME=$(jq -r '.filename' "$CAMERA_SETTINGS")
EXTENSION="${FULL_FILENAME##*.}"
FILENAME="${FULL_FILENAME%.*}"

# So scripts can conditionally ouput messages; DO NOT CHANGE NEXT LINES.
ALLSKY_DEBUG_LEVEL=$(jq -r '.debuglevel' "${CAMERA_SETTINGS}")
{
    "dayautoexposure": "1",
    "daymaxexposure": "200",
    "dayexposure": "100",
    "daymean": "0.5",
    "daybrightness": "100",
    "daydelay": "10000",
    "dayautogain": "1",
    "daymaxgain": "200",
    "daygain": "1",
    "daybin": "1",
    "nightautoexposure": "1",
    "nightmaxexposure": "20000",
    "nightexposure": "6000",
    "nightmean": "0.2",
    "nightbrightness": "50",
    "nightdelay": "10",
    "nightautogain": "0",
    "nightmaxgain": "16",
    "nightgain": "4",
    "nightbin": "1",
    "width": "0",
    "height": "0",
    "type": "99",
    "saturation": "50",
    "awb": "0",
    "wbr": "2.8",
    "wbb": "2",
    "quality": "95",
    "filename": "image.jpg",
    "rotation": "180",
    "flip": "0",
    "notificationimages": "0",
    "latitude": "26.22N",
    "longitude": "127.68E",
    "angle": "-9",
    "darkframe": "0",
    "locale": "en_US.UTF-8",
    "debuglevel": "1",
    "alwaysshowadvanced": "1",
    "showTime": "1",
    "timeformat": "%Y%m%d %H:%M:%S",
    "showExposure": "1",
    "showGain": "1",
    "showBrightness": "1",
    "showMean": "1",
    "showFocus": "1",
    "text": "",
    "extratext": "",
    "extratextage": "0",
    "textlineheight": "60",
    "textx": "100",
    "texty": "100",
    "fontname": "0",
    "fontcolor": "255",
    "smallfontcolor": "0 0 255",
    "fonttype": "0",
    "fontsize": "5",
    "fontline": "1",
    "outlinefont": "0",
    "showonmap": "0",
    "location": "",
    "owner": "",
    "websiteurl": "",
    "imageurl": "",
    "camera": "",
    "lens": "",
    "computer": ""
}
#!/bin/bash

# Upload settings

    # PROTOCOL determines how the files will be uploaded and is one of:
    #  "local"  copies to a location on your Pi.
    #  "ftp"    uploads to an FTP server.
    #       See the section for ftp PROTOCOL below.
    #  "ftps"   uploads to an FTP server that supports secure FTP transfer.
    #       *** Use "ftps" instead of "ftp" if you can - it's more secure than ftp. ***
    #       See the section for ftp PROTOCOL below.
    #  "sftp"   (SSH file transfer) - uploads to an FTP server that supports secure transfer.
    #       See the section for sftp PROTOCOL below.
    #  "scp"    (secure copy) - copies to a remote server.
    #       See the section for scp PROTOCOL below.   NOTE: "scp" PROTOCOL IS NOT IMPLEMENTED YET.
    #  "S3"     uploads to an Amazon Web Services (AWS) server.
    #       See the "S3 PROTOCOL only" section below.
PROTOCOL=""

# X*X*X*X*X*X*X*X*X*X*X*X          IMPORTANT NOTE          X*X*X*X*X*X*X*X*X*X*X*X*X*X
# YOU must create directories on the remote server (or on your Pi if PROTOCOL="local")
# for the variables below that end in "_DIR" (for example, IMAGE_DIR).
# X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*XX*X*X*X*X*X*X

# By default, the destination file name is the same as the file being uploaded.
# The *_DESTINATION_NAME variables below can be set to specify a DIFFERENT destination name.
# For example, if the file being uploaded is "allsky-20210710.mp4" you may want it
# called "allsky.mp4" on the remote web server so the name is always the same.
# In that case, set   VIDEOS_DESTINATION_NAME="allsky.mp4"
# If you want the destination file name to be the same as what's being uploaded,
# leave the *_DESTINATION_NAME blank.

# The WEB_*_DIR variables below are optionally used to copy a file to a directory on the Pi
# IN ADDITION TO being uploaded to a remote server.
# This is useful, for example, if your Pi's webpage cannot be reached from the Internet and
# you want an image to exist on the Pi AND on a remote web server.
# In that case, upload to the remote server using the PROTOCOL variable,
# and set the corresponding WEB_*_DIR variables to directories on your Pi.
# For example, for a timelapse, set VIDEOS_DIR to the name of the directory on the
# remote web server, and set WEB_VIDEOS_DIR to the name of the directory on your Pi,
# which will usually be in /var/www/html/allsky/videos.

    # The remote directory where the current "image.jpg" file be copied to.
IMAGE_DIR=""
WEB_IMAGE_DIR=""

    # The remote directory where the timelapse video should be uploaded to.
    # Some people prefer to put timelapse, keogram, and startrails in separate directories.
    # If you have the "allsky-website" package installed, use VIDEOS_DIR="/var/www/html/allsky/videos".
VIDEOS_DIR=""
VIDEOS_DESTINATION_NAME=""
WEB_VIDEOS_DIR=""

    # The remote directory where the keogram image should be copied to.
    # If you have the "allsky-website" package installed, use KEOGRAM_DIR="/var/www/html/allsky/keograms".
KEOGRAM_DIR=""
KEOGRAM_DESTINATION_NAME=""
WEB_KEOGRAM_DIR=""

    # The remote directory where the startrails image should be copied to.
    # If you have the "allsky-website" package installed, use STARTRAILS_DIR="/var/www/html/allsky/startrails".
STARTRAILS_DIR=""
STARTRAILS_DESTINATION_NAME=""
WEB_STARTRAILS_DIR=""

############### ftp, ftps, sftp, and scp PROTOCOLS only:
    # Enter the name of the remote server.  If you don't know it, ask your service provider.
REMOTE_HOST=""

    # Enter the username of the login on the remote server.
REMOTE_USER=""

    # Enter the password of the login on your FTP server.  Does not apply to PROTOCOL=scp.
REMOTE_PASSWORD=""

    # If you need special commands executed when connecting to the FTP server enter them here.
    # See the Wiki (https://github.com/thomasjacquin/allsky/wiki/11-Troubleshooting:-uploads)
    # for example commands to enter into LFTP_COMMANDS.
    # If you have more than one command to enter, separate them with semicolons (;).
    # This setting does not apply to the "scp" PROTOCOL.
LFTP_COMMANDS=""

############### S3 PROTOCOL only:
    # You will need to install the AWS CLI:
    #   sudo apt-get install python3-pip
    #   pip3 install awscli --upgrade --user
    #   export PATH=/home/pi/.local/bin:$PATH
    #   aws configure
    # When prompted, enter a valid access key ID, Secret Access Key, and Default region name,
    # for example, (e.g. "us-west-2").  Set the Default output format to "json" when prompted.

    # AWS CLI directory where the AWS CLI tools are installed.
    # If you used a different PATH variable above, change AWS_CLI_DIR to match it.
AWS_CLI_DIR="/home/pi/.local/bin"

    # Name of S3 Bucket where the files will be uploaded (must be in Default region specified above).
    # You may want to turn off or limit bucket versioning to avoid consuming lots of
    # space with multiple versions of the "image.jpg" files.
S3_BUCKET="allskybucket"

    # S3_ACL is set to private by default.
    # If you want to serve your uploaded files vis http(s), change S3_ACL to "public-read".  
    # You will need to ensure the S3 bucket policy is configured to allow public access to
    # objects with a public-read ACL.
    # You may need to set a CORS policy in S3 if the files are to be accessed by
    # Javascript from a different domain.
S3_ACL="private"

If you have program output or multi-line messages to include, add it like this so it formats correctly:

output/message line 1
output/message line 2

Log / configuration files

Follow the instructions for Reporting Issues in the Wiki, then ATTACH a copy of the file(s) above. Do NOT copy/paste them into this Issue.

EricClaeys commented 2 years ago

@ccdanieldb Did you check out the Wiki page on Troubleshooting Timelapse?

EricClaeys commented 2 years ago

@ccdanieldb Any update?

ccdanieldb commented 2 years ago

Its still not working. Do you have a link to the section that describes how to get the Timelapse up. It is saving the photos just not creating the time-lapse.

EricClaeys commented 2 years ago

Did you check out the Wiki page on Troubleshooting Timelapse? It's helped almost everyone.

ccdanieldb commented 2 years ago

Your right this dose look helpful.

https://github.com/thomasjacquin/allsky/wiki/Troubleshooting-timelapse

I will take another look at this tonight and see if I have any useful questions.

EricClaeys commented 1 year ago

@ccdanieldb Any update?

EricClaeys commented 1 year ago

Closing - no response in about 6 weeks. As far as I know, all timelapse creation-related issues have been one of the two problems described in the Wiki page so I'm confident following the instructions there will solve the problem.