Cheese recording not showing landlord coming into my trailer for repair

I used Cheese and set in a good position.

I used it for a few minutes.

Recorded fine.

Before I left the house, I had Cheese recording at a resolution that would not fill up my hard drive. It recorded 7 hours but the entry of my landlard to do repairs does not appear?

Is there a way to definitely know how long the recording was?

I am having problems seeing my posts. I click on my avatar and see a lot of things.

1 Like

Unless you can configure your video camera to include the date/time in the video feed that is being captured by Cheese, you are out of luck.

Cheese has no way to include an actual date/time overlay while capturing a video stream. :frowning:

1 Like

Hey Eric,

Pl ease re-read my post.

You can always open it with "Handbrake".

The application opens with "Chapters" selected. If you change that to "Seconds", it will give you the video end time (total time).

Or, you can use

mediainfo-gui {filename}

then click on "View -> Text" and look for "Duration:".

Mediainfo__Snapshot

The above snapshots are for the same file in the two applications.

The only way to know for sure if the video didn't glitch is if the source (camera) fed the time in the stream.

4 Likes

No, my video did not show him entering my trailer.

It recorded for 7 hours, so it should have showed him entering.

I think Cheese stored the files in some other directory other than

/home/andy/Videos/Webcam/

Someone recommended the installation of a security program.

It was about 300 Mbtes but I forgot the name of it.

I know nothing about Cheese itself and can't seem to find docs on how it can be configured, even on the GitLab site. I even went so far as to install Cheese on my UM 22.04, and don't see anything that could help, beyond what I already said.

For Cheese config, this might help.

My only other suggestion is that, possibly, some other video application may have logic to break a non-stop stream of video into pre-configured time-slices, maybe 1 file per 20 minutes or per hour. That would give you many files and, possibly, the App's logic would be to add a date/time string to the filename on storage, to indicate the sequence or window of time recorded.

I am using guvcview.

Much better program.

If guvcview doesn't give you the time/date overlay (everywhere I checked didn't show that option), ffmpeg will do that for you, per this.

ffmpeg -y 
-i /dev/video0 
-vf "drawtext=fontfile=FreeMono.ttf:text='%{localtime}'" 
-preset ultrafast 
-f mp4 output.mp4

this command creates output.mp4 with a date stamp at the very top left of the video as seen in this screenshot.

3 Likes

Thanks Eric. What
is the purpose ?

Some of the meds my "Sawbones" has me on have me on cause restlessness.

i Ilike being producitve but I need some downtime.

That is why I make so many posts here,

Having the camera/recording provide a date/time overlay (URL reference provided; reconfirmed by example from Pavlos) is that such a recording could be used as legal evidence, if there was ever a question of someone having entered your premises and done anything illicit, which you only discovered at a later date.

As long as you did not "trim" that original recording (after the fact, in order to limit the contents to the timeframe specific to the display of an offense), that recording would be acceptable as non-tampered evidence. :slight_smile:

Which is why, given that much could be visible on a long recording, it would be beneficial to arrange for the recording of multiple time-slices of 15 min, 20 min, or 1 hour, depending on long a window, or how many files, you would like to manage.

If you would like, I could work on creating such a script for you, but I would need you to do the testing, because I don't have the video camera. I actually started some rough scripting when I first answered your question.

I went ahead and came up with this script.

Hope that helps. :slight_smile:

Script "VIDEO__Record_LiveStreamWithTimeStamp.sh":
(EDIT: removed spurious "-t" in function)

#!/bin/bash

####################################################################################################
###
###	Script to simplify interraction with ffmpeg for recording from video stream
###
###	REF:  https://askubuntu.com/a/428501
###	REF:  https://ubuntu-mate.community/t/cheese-recording-not-showing-landlord-coming-into-my-trailer-for-repair/28390/9
###
####################################################################################################


####################################################################################################
recordSegment()
{

	###
	### Options used in REF which were not used by Pavlos in his response demo
	###
	#	-f video4linux2			\
	#	-s 640x480			\
	#	-r 30				\
	#	-vcodec libx264			\
	#	-vb 2000k 			\

	ffmpeg	\
	-i /dev/video0			\
	-preset ultrafast		\
	${segInterval}			\
	-vf "${textOverlayParameters}"	\
	-f mp4 "${videoFile}"
}


####################################################################################################
recordSlice()
{
	videoFile="${videoFilePref}_${sliceStart}.mp4"
	printf "\n\t Starting capture of video stream for next ${sliceMax} minutes as:\n\t -> ${videoFile}\n"

	recordSegment
}


####################################################################################################
###
###	'drawtext' option specifications
###
#fontSpec="fontfile=DejaVuSans-Bold.ttf"
fontSpec="fontfile=FreeMono.ttf"

#timeFmt="text='\\%T'"
timeFmt="text='\\%{localtime}'"

fontClr="[email protected]"
timePosn="x=7:y=460"

textOverlayParameters="drawtext=${fontSpec}:${timeFmt}:${fontClr}:${timePosn}"

#echo ${textOverlayParameters}
#exit


####################################################################################################

mode=1
timeTot=0
timeWait=0
count=0
label=0
videoFilePref="vidrecord"

sliceMax=0
 
while [ $# -gt 0 ]
do
	case "${1}" in
		"--single" )
			mode=1
			shift
			;;
		"--slices" )
			### number of recording slices to cover specified duration
			mode=2
			slices="${2}"
			shift ; shift
			;;
		"--duration" )
			### total recording time		[ units in hours ]
			timeTot="${2}"
			count=1
			shift ; shift
			;;
		"--wait" )
			### wait time before start		[ units in minutes ]
			timeWait="${2}"
			shift ; shift
			;;
		"--label" )
			videoFilePref="${2}"
			shift ; shift
			;;
		"--label_int" )
			label=1
			shift
			;;
		"--label_hms" )
			label=0
			shift
			;;
		"--debug" )
			dbg=1
			shift
			;;
		* ) printf "\n\t Invalid parameter used on command line. \n\t Only valid: [ --single | --slices {count} ] [ --duration {hours} ] [ --wait {minutes} ] [ --label {string} ] [ --label_int | --label_hms ] [ --debug ] \n Bye!\n\n" ; exit 1
	esac
done


####################################################################################################


if [ ${mode} -eq 1 ]
then
	test ${timeTot} -eq 0 && { printf "\n\t ERROR:  Need to specify total record time with '--duration {hours}' option.\n Bye!\n\n" ; exit 1 ; }
	
	if [ ${timeWait} -gt 0 ]
	then
		printf "\n\t WAITING ${timeWait} minute(s) before proceed with video recording ...\n\n"
		hTime=$( expr ${timeWait} \* 60 )
		sleep ${hTime}
	fi

	sliceMax=$( expr ${timeTot} \* 60 )
	segInterval="-t $( expr ${sliceMax} \* 60 )"

	if [ ${label} -eq 1 ]
	then
		sliceStart="$(date '+%Y%m%d_%H%M' )_${sliceMax}m"
	else
		sliceStart=$(date '+%Y%m%d_%H%M%S' )
	fi

	recordSlice
	exit
fi


if [ ${mode} -eq 2 ]
then
	test ${timeTot} -eq 0 && { printf "\n\t ERROR:  Need to specify total record time with '--duration {hours}' option.\n Bye!\n\n" ; exit 1 ; }

	if [ ${timeWait} -gt 0 ]
	then
		printf "\n\t WAITING ${timeWait} minute(s) before proceed with video recording ...\n\n"
		hTime=$( expr ${timeWait} \* 60 )
		sleep ${hTime}
	fi

	duration=$( expr ${timeTot} \* 60 )
	sliceMax=$( expr ${duration} / ${slices} )
	segInterval="-t $( expr ${sliceMax} \* 60 )"

	indx=0
	while [ ${indx} -lt ${slices} ]
	do
		if [ ${label} -eq 1 ]
		then
			sliceStart="$(date '+%Y%m%d_%H%M' )_${sliceMax}m"
		else
			sliceStart=$(date '+%Y%m%d_%H%M%S' )
		fi

		recordSlice
		indx=$( expr ${indx} + 1 )
	done
	exit
fi


exit

Session log for "--single" mode:

./VIDEO__Record_LiveStreamWithTimeStamp.sh --single --duration 2 --label_int

	 Starting capture of video stream for next 120 minutes as:
	 -> vidrecord_20241024_1741_120m.mp4

Session log with "--slices" mode:

./VIDEO__Record_LiveStreamWithTimeStamp.sh --slices 6 --duration 2 --label_hms

	 Starting capture of video stream for next 20 minutes as:
	 -> vidrecord_20241024_181047.mp4

	 Starting capture of video stream for next 20 minutes as:
	 -> vidrecord_20241024_183047.mp4

	 Starting capture of video stream for next 20 minutes as:
	 -> vidrecord_20241024_185047.mp4

	 Starting capture of video stream for next 20 minutes as:
	 -> vidrecord_20241024_191047.mp4

	 Starting capture of video stream for next 20 minutes as:
	 -> vidrecord_20241024_193047.mp4

	 Starting capture of video stream for next 20 minutes as:
	 -> vidrecord_20241024_195047.mp4
1 Like

Thanks, I had to go to the E.R. today.

I will study it.

Is the 2nd line the name of the input video?

If so, I guess the file extension is not needed.

@ericmarceau

user@cw:~$ ./eric --single --duration 1

1st run
script throws an error, Invalid duration specification for t: -t

segInterval="$( expr ${sliceMax} * 60 )" <---- delete -t

Next run
script throws another error, Invalid duration specification for t: -vf

2 Likes

Thank you, Pavlos.

As I told Andy, I don't have a camera to prove out the actual command, but I tested out all other functions with the ffmpeg commented out.

Would you mind trying out the revised script for me?

Error log for missing video device (no other errors flagged):

./VIDEO__Record_LiveStreamWithTimeStamp.sh --single --duration 2

	 Starting capture of video stream for next 120 minutes as:
	 -> vidrecord_20241025_144018.mp4
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[video4linux2,v4l2 @ 0x63b210830240] Cannot open video device /dev/video0: No such file or directory
/dev/video0: No such file or directory

The 2nd line is the device file that your camera's stream is being fed to. There should only be one such "video?" if you only have one camera.

I do not understand what parameters should be used for duration option.

I thought we were once working on time/date stamp?

ERROR: Need to specify total record time with '--duration {hours}' option.

Andy, the script I offered is an attempt to give you a template for customizing to your needs.

That script incorporates the date and time stamp in the video with the ffmpeg's "drawtext" option string (that is composed of other parameters which I've explicitly defined as parameters, to make it easier to understand).

The "--duration" option is my suggested approach for giving a length of the recording time (using hours), which is then converted into the value for ffmpeg's "-t" option which is in seconds.

But all of that can be changed by yourself, if you prefer to work with minutes, and modify the calculations in the script accordingly. If you want me to change that to minutes (i.e. 720 minutes for a 12 hour recording), I can modify my script for that, if you prefer.

I backed away from specifying start and end times because it got a bit too complicated for me. That is why I only offered a parameter for wait, in minutes, before the recording starts for the specified duration.

---- edit -----

... ( snip ) ...
Please see my later posting for the finalized script.

"--duration" was replaced by the two mutually-exclusive options "--hours" and "--minutes".