Revisions to configuration options.
1. Revise config options to be `movie_` and `picture_`
2. Revise config options to align with topic and code.
* motion_video_pipe, ipv6_enabled, rtsp_uses_tcp
* switchfilter, logfile, process_id_file
3. Revise depreciated options to still be valid for webcontrol and config files.
4. Revise distributed config files to only include most common options
5. Revise sequence of config options to be arranged by topic.
6. Revise code to use names consistent with config parms.
7. Revise manual, guide and code to specify same default values.
8. Update guide and manual to reflect revised option names.
1. Revert to just capturing time directly rather than in a routine.
2. Check for null format context pointer before writing trailer.
3. Terminate movie when lost connection.
4. Clean up context when failed resize.
5. Unlock mutex on failed first image.
6. Fix memory leak when recovering from watchdog timeout.
* High Resolution
Refactor the netcam_rtsp module and associated image variables to allow for processing a dual stream from rtsp cameras.
Continue the process of segregating the functionality of the netcams into distinct modules based upon their function.
Resolve issues related to RTSP Cameras
1. Do not drain the codec at each frame
2. Add variable active to context and remove #ifdef HAVE_FFMPEG
3. Reset return code for encoding when timing problems for pts
4. Set the jpeg error messages to debug level.
5. Comment out the frame timing debug messages that flood log.
* Changed MOTION_LOG macro and remover "%s:" from the format string
Function name will be now auto added
* Re-applied log-update after conflict resolution
* Some old style logging still remaining, updated
1. Revise the PTS to allow for the capture of the first image by revising the initialization of last_pts
2. Elminate the incrementing by 1 when we have timing issues since this puts all subsequent
frames out of sync with timing/pts problems
3. Unref the packets when encode and PTS functions return errors to prevent leaks.
4. Revise logging to report more values when in test mode.
We eliminate gaps in movie by resetting movie start time. By doing so,
we unintentionally reset the PTS value that has to be monotonically
increasing. This fixes it by offsetting the PTS value by a base PTS
value.
Signed-off-by: Joo Aun Saw <jasaw81@gmail.com>
This commit resolves some of the netcam v4l2 items and a few other
small issues
1. Use the correct return codes for the new function rtsp_decode_video
2. Silence the notices on reconnecting
3. Revise the v4l2 to video4linux2 for old libav versions
4. Add additional options for the input_format
5. Do not permit users to specify zero for camera height or width
6. Eliminates pthread detection
7. Revise the ffmpeg messages to INF
8. Adds H264 palette option
This commit adds functionality to use a v4l2 device via the netcam_url
option. This will allow for more v4l2 devices since the netcam_url
uses the ffmpeg libraries which should be able to to decode and transform
the unusual pixel formats and sizes.
* ffmpeg 3.1 Revisions
The ffmpeg versions after 3.1 eliminated the stream codec which was used
in many different ways in the previous code. This commit revises the ffmpeg
module to use smaller functions and eliminates the greyscale image handling
since all images are yuv.
* ffmpeg gop and pts
Gop: Revise the gop based upon the fps of the requested video
to make sure we get enough I frames for low fps videos.
PTS: Revise the PTS for the timelapse videos as well as permit
debug messages of the PTS when in test mode.
* Libav Problem
Closes#144
This commit resolves a regression error when selecting the without-ffmpeg option.
1. The ffmpeg configuration options are now valid whether or not the user has
included ffmpeg. Instead the user is notified when ffmpeg options are
requested.
2. The initial consolidation of the HAVE_FFMPEG duplicated the public functions
in the #else (no ffmpeg) section. This commit changes this so that the #IF
are inside of the public functions so we don't have to worry about keeping
the parameters the same between them.
3. The timevalue was added to the ffmpeg header for the situation when
ffmpeg is not included.
The previous method for calculating the PTS was to extract the time when
the particular function was being executed. e.g. The time when the open
ffmpeg function was executed, the time that the image was encoded into the
movie. This commit revises that behaviour to use instead the timevalues
that are attached to each image. This is done to handle the precapture
situation in which all the precapture images were sent in at once at the
start of the event. For the open function, the timevalue is obtained
from the oldest image in the ring buffer.
1. Consolidate the HAVE_FFMPEG pre-processor directives that are scattered
through the code into the ffmpeg.c module. This makes it so that a single
pre-processor check can be used rather than surrounding every call scattered
through the code.
2. Always compile/include the ffmpeg.c module
We now use ffmpeg's built in support for locking instead of trying to
lock ourselves before calling ffmpeg.
This may solve some race condition crashes.
Fixes#206
avformat_network_init only needs to be called once on startup and once
on shutdown.
The functions aren't thread safe, and we can't fix that by protecting
them with the 'global_lock' as other functions in ffmpeg that we call
and that access the same data are not protected by the global_lock
(and can't be protected by that lock).
Fixes#194 - the particular issue we're seeing there is something like:
thread 1: lock mutex
thread 1: deinit network
thread 1: init network
thread 1: unlock mutex
thread 2: lock mutex
thread 2: deinit network
thread 1: call into an ffmpeg operation
thread 1: ffmpeg complains "init network" not called
The presentation time stamp(pts) indicates the time which the movie
player should display a particular frame. In the previous changes
to the pts, we set the time basis to be in microseconds by specifying
the denomintor to be equal to 1000. This allows for additional precision
when we assign the pts when writing the frame. For the libav variant
the time basis assignment is ignored and instead the framerate is
used. The use of the framerate causes problems when it is small.
At 2fps, time intervals of 1 to 499 microseconds round to a pts
of zero, 500 to 1499 microseconds round to pts 1, etc. This
commit adds a variable to keep track of the last pts used in writing
the frame. If the newly calculated pts is not greater than the previous
pts, we just increment the pts by 1 which would be the full 1/framerate
increment. This could result visually twitchy videos at low framerates.
It could also have a compounding affect of eliminating the handling of
variable framerates and just fallback to a constant framerate video.