Page 1 of 1

Filters - Create video - Issue

Posted: Thu Sep 21, 2017 12:11 am
by wooka
When I do manual "Generate video" from web I have not any problem.
Also if run it from cli. Like this
/usr/bin/perl -wT /usr/bin/zmvideo.pl -e $ffmpeg_event -f avi -r 1.00 -s 1.00 -o

But when it runs from Filters - "Create video for all matches video" checked with "Run filter in background" checked.
50%/50% I have NOT full video file with ffmpeg.log with various errors.
Sach as:

Code: Select all

Enter command: <target>|all <time>|-1 <command>[ <argument>]

Code: Select all

key    function
?      show this help
+      increase verbosity
-      decrease verbosity
c      Send command to first matching filter supporting it
C      Send/Que command to all matching filters
D      cycle through available debug modes
h      dump packets/hex press to cycle through the 3 states
q      quit
s      Show QP histogram
Or huge size of ffmpeg.log with debug info.

ZoneMinder = 1.30.4
FFMPEG_OUTPUT_OPTIONS = -loglevel panic -c:v libx264 -preset ultrafast
FFMPEG_OPEN_TIMEOUT = 3600 (didnt find this options in code, but set 3600 anyway)

What it is wrong with this?

my script which resolve some problems sometimes and drops jpegs.

Code: Select all

#!/bin/sh -x

path_event="$1"
wait_count=0
wait_limit=300
file_cleanup_log="$path_event/clenup.log"
file_ffmpeg_log="$path_event/ffmpeg.log"

echo `date` start >> $file_cleanup_log

ffmpeg_bin="/usr/bin/ffmpeg"
ffmpeg_opt="-y -r 8 -i $path_event/%05d-capture.jpg -s 1280x720 -loglevel panic -threads 1 -c:v libx264"
ffmpeg_event=$(find $path_event -type f -name ".*" | head -1)
ffmpeg_event=${ffmpeg_event#*.}
ffmpeg_video="Event-$ffmpeg_event-r1-s1.avi"

exec_check="ps ax| grep -v grep | grep $ffmpeg_video"
cd $path_event
while [ -n "$(eval $exec_check)" -a $wait_count -lt $wait_limit ]; do
        wait_count=$((wait_count+1))
        sleep 1
done

if [ ! -r $path_event/$ffmpeg_video -o -s $file_ffmpeg_log ]; then
        size_video_old=$(wc -c $path_event/$ffmpeg_video | awk '{print $1}')
        mv -f $path_event/$ffmpeg_video $path_event/$ffmpeg_video-old
        /usr/bin/perl -wT /usr/bin/zmvideo.pl -e $ffmpeg_event -f avi -r 1.00 -s 1.00 -o
        echo "[ done re-encode ]" >> $file_cleanup_log
else
        echo "[ no need re-encode ]" >> $file_cleanup_log
fi

size_video=$(wc -c $path_event/$ffmpeg_video | awk '{print $1}')
size_total=$(wc -c $path_event/*.jpg | awk '/total/{print $1}')
size_coof=$(echo $size_total / $size_video | bc)
echo [ size_video=$size_video / size_total=$size_total = coof $size_coof ] >> $file_cleanup_log

[ -n "$size_video_old" ] && if [ $size_video_old -eq $size_video ]; then
        echo "[ old and new video have SAME size ]" >> $file_cleanup_log
        rm -f $path_event/$ffmpeg_video-old
else
        if [ $size_video_old -lt $size_video ]; then
                echo "[ new video has MORE size old=$size_video_old vs new=$size_video ]" >> $file_cleanup_log
                rm -f $path_event/$ffmpeg_video-old
        else
                echo "[ new video has LESS size old=$size_video_old vs new=$size_video ]" >> $file_cleanup_log
                echo "[ so getting back OLD video ]" >> $file_cleanup_log
                mv -f $path_event/$ffmpeg_video-old $path_event/$ffmpeg_video
        fi
fi

[ -s $path_event/$ffmpeg_video ] && rm -f $path_event/*.jpg

echo `date` end >> $file_cleanup_log


Re: Filters - Create video - Issue

Posted: Thu Sep 21, 2017 5:47 pm
by mikb
You seem to be confusing FFMPEG (in the first example) by feeding it some unexpected input.

Does any of this help?

https://unix.stackexchange.com/question ... -in-a-loop

https://bbs.archlinux.org/viewtopic.php?id=182037

Re: Filters - Create video - Issue

Posted: Fri Sep 22, 2017 8:34 am
by wooka
My question was about difference between video generation (ffmpeg) launched from Filter and cli/web?
Couse In most cases I have cutted (not full) video when it works from Filter.

My script just look at ffmpeg.log, and if is there some errors re-generate video. Also drops jpeg files.

Re: Filters - Create video - Issue

Posted: Fri Sep 22, 2017 5:47 pm
by mikb
That might be your question, but my point is that the error message you helpfully supplied indicates that FFMPEG is confused, and this won't be helping you debug your situation (which may go away or be partly solved by fixing the confused FFMPEG).

The error message you quote "Enter command ...." tends to appear when using FFMPEG in a script, and it gets confused by seeking some input. You may need to shut this behaviour off using the tricks listed in the links above. Then maybe FFMPEG stands a chance of running over the whole video, not cutting it short.