This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tips:video [2018/01/09 14:54] – [camera motion] scipio | tips:video [2020/09/02 15:59] (current) – [from images to video] scipio | ||
|---|---|---|---|
| Line 26: | Line 26: | ||
| < | < | ||
| # 5 images per seconds | # 5 images per seconds | ||
| - | ffmpeg -y -framerate 5 -pattern_type glob -i ' | + | ffmpeg -y -framerate 5 -pattern_type glob -i ' |
| </ | </ | ||
| + | |||
| + | |||
| + | < | ||
| + | ffmpeg -r 30 -s 1080x1080 -i imgs/ | ||
| + | </ | ||
| + | * crf: quality, minor is better | ||
| + | |||
| + | ===== from video to images ===== | ||
| + | |||
| + | |||
| + | < | ||
| + | ffmpeg -i input.mp4 -qscale:v 2 imgs/ | ||
| + | </ | ||
| + | * qscale:v is quality, 2-15 minor is better | ||
| ===== MKV===== | ===== MKV===== | ||
| Line 88: | Line 102: | ||
| < | < | ||
| tomkv file1 file2 ... | tomkv file1 file2 ... | ||
| + | </ | ||
| + | |||
| + | ===== lates ===== | ||
| + | |||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | |||
| + | CHATID=$1 | ||
| + | BASEpath='/ | ||
| + | |||
| + | [ -z " | ||
| + | |||
| + | |||
| + | for folder in $(find / | ||
| + | |||
| + | for video in $(find $folder -newer $folder.jpg -name " | ||
| + | i=$(echo " | ||
| + | preview=$BASEpath/ | ||
| + | |||
| + | ago_seconds=$(( $(date +%s) - $(stat -c %Y $video ) )) | ||
| + | if [ $ago_seconds -le 3600 ]; then | ||
| + | ago=" | ||
| + | else | ||
| + | ago=" | ||
| + | fi | ||
| + | echo "video $video is $ago" | ||
| + | |||
| + | ( ffmpeg -i $video -r 0.5 -c:v libx264 -an -t 30 -y $preview </ | ||
| + | ~/ | ||
| + | sleep 1 | ||
| + | done | ||
| + | done | ||
| + | </ | ||
| + | |||
| + | ===== on motion ===== | ||
| + | |||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | CHROOT=/ | ||
| + | |||
| + | FILENAME=$1 | ||
| + | |||
| + | # name of the first folder level inside CHROOT | ||
| + | INPUT=$(cut -d'/' | ||
| + | |||
| + | # lowercase | ||
| + | INPUT=${INPUT,, | ||
| + | |||
| + | LOCK=${CHROOT}${INPUT}.lock | ||
| + | [ -f $FILENAME ] && ln -sf $FILENAME ${CHROOT}${INPUT}.jpg | ||
| + | |||
| + | |||
| + | [ -f $LOCK ] && exit 0 | ||
| + | |||
| + | touch $LOCK | ||
| + | name=" | ||
| + | i=${INPUT/ | ||
| + | video=$CHROOT/ | ||
| + | |||
| + | echo " | ||
| + | ( ffmpeg -i rtsp:// | ||
| + | </ | ||
| + | |||
| + | ===== telegram ===== | ||
| + | |||
| + | < | ||
| + | #!/bin/sh | ||
| + | |||
| + | set -x | ||
| + | |||
| + | caption=$1 | ||
| + | video=$2 | ||
| + | CHATID=$3 | ||
| + | |||
| + | # | ||
| + | TOKEN=" | ||
| + | |||
| + | [ -z " | ||
| + | |||
| + | |||
| + | curl -F chat_id=" | ||
| + | -F document=@" | ||
| + | -F caption=" | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== preview day ===== | ||
| + | |||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | set -x | ||
| + | |||
| + | CHATID=$1 | ||
| + | CHATID=${CHATID: | ||
| + | i=$2 | ||
| + | i=${i:=1} | ||
| + | SPEED=${3} | ||
| + | SPEED=${SPEED: | ||
| + | |||
| + | INVSPEED=$(echo " | ||
| + | |||
| + | [ -z " | ||
| + | |||
| + | BASE=/ | ||
| + | |||
| + | DAY=$(date +" | ||
| + | video=$BASE/ | ||
| + | |||
| + | echo " | ||
| + | |||
| + | # 0.02: 20 volte la velocita | ||
| + | |||
| + | if [ ! -f $video ]; then | ||
| + | ffmpeg -f concat -safe 0 \ | ||
| + | -i <(find " | ||
| + | -c:v libx264 -filter:v " | ||
| + | # -r 0.1 -c:v libx264 -an -y $video | ||
| + | fi | ||
| + | |||
| + | |||
| + | ~/ | ||
| </ | </ | ||