mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 13:46:32 +00:00
motioneye: Use extpipe ffmpeg h264_omx encoder
This commit is contained in:
parent
e051448509
commit
0008c743e4
@ -1,19 +0,0 @@
|
|||||||
commit 7a916dea0c90f7040ce3c5a78da560edc4d9ba53
|
|
||||||
Author: Joo Aun Saw <jasaw@dius.com.au>
|
|
||||||
Date: Fri Aug 4 14:36:04 2017 +1000
|
|
||||||
|
|
||||||
allow extpipe motion option
|
|
||||||
|
|
||||||
diff --git a/motioneye/config.py b/motioneye/config.py
|
|
||||||
index 48e8cf5..1b1b087 100644
|
|
||||||
--- a/motioneye/config.py
|
|
||||||
+++ b/motioneye/config.py
|
|
||||||
@@ -118,6 +118,8 @@ _KNOWN_MOTION_OPTIONS = set([
|
|
||||||
'threshold',
|
|
||||||
'videodevice',
|
|
||||||
'width',
|
|
||||||
+ 'use_extpipe',
|
|
||||||
+ 'extpipe',
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
94
package/motioneye/use-extpipe-ffmpeg-h264-omx-encoding.patch
Normal file
94
package/motioneye/use-extpipe-ffmpeg-h264-omx-encoding.patch
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
commit d6b2e8203453c75e3b64a441a66091d9a099f31e
|
||||||
|
Author: Joo Aun Saw <jasaw@dius.com.au>
|
||||||
|
Date: Mon Aug 7 12:09:04 2017 +1000
|
||||||
|
|
||||||
|
Use extpipe ffmpeg h264_omx encoder
|
||||||
|
|
||||||
|
Use ffmpeg h264_omx hardware accelerated encoder via extpipe when output
|
||||||
|
video format is H264. Applies to mp4 and mkv containers.
|
||||||
|
|
||||||
|
diff --git a/motioneye/config.py b/motioneye/config.py
|
||||||
|
index 48e8cf5..ddf10c9 100644
|
||||||
|
--- a/motioneye/config.py
|
||||||
|
+++ b/motioneye/config.py
|
||||||
|
@@ -58,6 +58,10 @@ _EXPONENTIAL_QUALITY_FACTOR = 100000 # voodoo
|
||||||
|
_EXPONENTIAL_DEF_QUALITY = 511 # about 75%
|
||||||
|
_MAX_FFMPEG_VARIABLE_BITRATE = 32767
|
||||||
|
|
||||||
|
+_EXTPIPE_FFMPEG_H264_OMX_CODEC = {'mp4', 'mkv'}
|
||||||
|
+_EXTPIPE_FFMPEG_H264_OMX_CODEC_ARGS = {'mp4':'-f mp4 %f.mp4', 'mkv':'-f matroska %f.mkv'}
|
||||||
|
+_EXTPIPE_FFMPEG_H264_OMX_CMD = 'ffmpeg -y -f rawvideo -pix_fmt yuv420p -video_size %wx%h -framerate %fps -i pipe:0 -c:v h264_omx -profile:v high -b:v 3000000'
|
||||||
|
+
|
||||||
|
_KNOWN_MOTION_OPTIONS = set([
|
||||||
|
'auto_brightness',
|
||||||
|
'brightness',
|
||||||
|
@@ -118,6 +122,8 @@ _KNOWN_MOTION_OPTIONS = set([
|
||||||
|
'threshold',
|
||||||
|
'videodevice',
|
||||||
|
'width',
|
||||||
|
+ 'use_extpipe',
|
||||||
|
+ 'extpipe',
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
@@ -737,6 +743,8 @@ def motion_camera_ui_to_dict(ui, old_config=None):
|
||||||
|
'movie_filename': ui['movie_file_name'],
|
||||||
|
'max_movie_time': ui['max_movie_length'],
|
||||||
|
'@preserve_movies': int(ui['preserve_movies']),
|
||||||
|
+ 'use_extpipe': False,
|
||||||
|
+ 'extpipe': '',
|
||||||
|
|
||||||
|
# motion detection
|
||||||
|
'@motion_detection': ui['motion_detection'],
|
||||||
|
@@ -919,6 +927,11 @@ def motion_camera_ui_to_dict(ui, old_config=None):
|
||||||
|
elif recording_mode == 'continuous':
|
||||||
|
data['emulate_motion'] = True
|
||||||
|
|
||||||
|
+ if ui['movie_format'] in _EXTPIPE_FFMPEG_H264_OMX_CODEC:
|
||||||
|
+ data['ffmpeg_output_movies'] = False
|
||||||
|
+ data['use_extpipe'] = True
|
||||||
|
+ data['extpipe'] = _EXTPIPE_FFMPEG_H264_OMX_CMD + ' ' + _EXTPIPE_FFMPEG_H264_OMX_CODEC_ARGS[ui['movie_format']]
|
||||||
|
+
|
||||||
|
data['ffmpeg_video_codec'] = ui['movie_format']
|
||||||
|
q = int(ui['movie_quality'])
|
||||||
|
if motionctl.needs_ffvb_quirks():
|
||||||
|
@@ -1120,6 +1133,8 @@ def motion_camera_dict_to_ui(data):
|
||||||
|
'movie_file_name': data['movie_filename'],
|
||||||
|
'max_movie_length': data['max_movie_time'],
|
||||||
|
'preserve_movies': data['@preserve_movies'],
|
||||||
|
+ 'use_extpipe': False,
|
||||||
|
+ 'extpipe': '',
|
||||||
|
|
||||||
|
# motion detection
|
||||||
|
'motion_detection': data['@motion_detection'],
|
||||||
|
@@ -1303,7 +1318,7 @@ def motion_camera_dict_to_ui(data):
|
||||||
|
if picture_filename:
|
||||||
|
ui['image_file_name'] = picture_filename
|
||||||
|
|
||||||
|
- if data['ffmpeg_output_movies']:
|
||||||
|
+ if data['ffmpeg_output_movies'] or data['use_extpipe']:
|
||||||
|
ui['movies'] = True
|
||||||
|
|
||||||
|
if emulate_motion:
|
||||||
|
@@ -1883,6 +1898,8 @@ def _set_default_motion_camera(camera_id, data):
|
||||||
|
|
||||||
|
data.setdefault('movie_filename', '%Y-%m-%d/%H-%M-%S')
|
||||||
|
data.setdefault('max_movie_time', 0)
|
||||||
|
+ data.setdefault('use_extpipe', False)
|
||||||
|
+ data.setdefault('extpipe', '')
|
||||||
|
data.setdefault('ffmpeg_output_movies', False)
|
||||||
|
if motionctl.has_new_movie_format_support():
|
||||||
|
data.setdefault('ffmpeg_video_codec', 'mp4') # will use h264 codec
|
||||||
|
diff --git a/motioneye/mediafiles.py b/motioneye/mediafiles.py
|
||||||
|
index 680cdd9..cc54008 100644
|
||||||
|
--- a/motioneye/mediafiles.py
|
||||||
|
+++ b/motioneye/mediafiles.py
|
||||||
|
@@ -216,7 +216,7 @@ def cleanup_media(media_type):
|
||||||
|
((camera_config['emulate_motion'] or camera_config['output_pictures']) and camera_config['picture_filename']) or
|
||||||
|
(camera_config['snapshot_interval'] and camera_config['snapshot_filename']))
|
||||||
|
|
||||||
|
- movies_enabled = camera_config['ffmpeg_output_movies']
|
||||||
|
+ movies_enabled = camera_config['ffmpeg_output_movies'] or camera_config['use_extpipe']
|
||||||
|
|
||||||
|
if media_type == 'picture' and not still_images_enabled:
|
||||||
|
continue # only cleanup pictures for cameras with still images enabled
|
Loading…
x
Reference in New Issue
Block a user