mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 13:46:32 +00:00
don't use h264_omx via C API, use extpipe instead
motion interfacing with ffmpeg C API proved to be unstable.
This commit is contained in:
parent
9fd9a6f8ca
commit
e051448509
@ -1,24 +0,0 @@
|
||||
diff --git a/ffmpeg.c b/ffmpeg.c
|
||||
index 30a9cde..829d5a2 100644
|
||||
--- a/ffmpeg.c
|
||||
+++ b/ffmpeg.c
|
||||
@@ -484,7 +484,13 @@ static int ffmpeg_set_codec(struct ffmpeg *ffmpeg){
|
||||
char errstr[128];
|
||||
int chkrate;
|
||||
|
||||
- ffmpeg->codec = avcodec_find_encoder(ffmpeg->oc->oformat->video_codec);
|
||||
+ ffmpeg->codec = NULL;
|
||||
+ if (ffmpeg->oc->oformat->video_codec == AV_CODEC_ID_H264)
|
||||
+ ffmpeg->codec = avcodec_find_encoder_by_name("h264_omx");
|
||||
+ else if (ffmpeg->oc->oformat->video_codec == AV_CODEC_ID_MPEG4)
|
||||
+ ffmpeg->codec = avcodec_find_encoder_by_name("mpeg4_omx");
|
||||
+ if (!ffmpeg->codec)
|
||||
+ ffmpeg->codec = avcodec_find_encoder(ffmpeg->oc->oformat->video_codec);
|
||||
if (!ffmpeg->codec) {
|
||||
MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "%s: Codec %s not found", ffmpeg->codec_name);
|
||||
ffmpeg_free_context(ffmpeg);
|
||||
@@ -926,4 +932,3 @@ int ffmpeg_put_image(struct ffmpeg *ffmpeg, unsigned char *image, const struct t
|
||||
return 0;
|
||||
#endif // HAVE_FFMPEG
|
||||
}
|
||||
-
|
@ -1,33 +0,0 @@
|
||||
diff --git a/ffmpeg.c b/ffmpeg.c
|
||||
index 8f66121..9634a20 100644
|
||||
--- a/ffmpeg.c
|
||||
+++ b/ffmpeg.c
|
||||
@@ -451,20 +451,27 @@ static int ffmpeg_set_pts(struct ffmpeg *ffmpeg, const struct timeval *tv1){
|
||||
static int ffmpeg_set_quality(struct ffmpeg *ffmpeg){
|
||||
|
||||
char crf[4];
|
||||
+ int bit_rate;
|
||||
|
||||
ffmpeg->opts = 0;
|
||||
if (ffmpeg->vbr > 100) ffmpeg->vbr = 100;
|
||||
if (ffmpeg->ctx_codec->codec_id == MY_CODEC_ID_H264 ||
|
||||
ffmpeg->ctx_codec->codec_id == MY_CODEC_ID_HEVC){
|
||||
if (ffmpeg->vbr > 0) {
|
||||
+ if (ffmpeg->vbr < 10) ffmpeg->vbr = 10;
|
||||
+ //bit_rate = ffmpeg->width * ffmpeg->height * ffmpeg->fps * quality_factor
|
||||
+ bit_rate = (ffmpeg->width * ffmpeg->height * ffmpeg->fps * ffmpeg->vbr) >> 8;
|
||||
ffmpeg->vbr = (int)(( (100-ffmpeg->vbr) * 51)/100);
|
||||
} else {
|
||||
+ bit_rate = ffmpeg->bps;
|
||||
ffmpeg->vbr = 28;
|
||||
}
|
||||
snprintf(crf, 4, "%d",ffmpeg->vbr);
|
||||
- av_dict_set(&ffmpeg->opts, "preset", "ultrafast", 0);
|
||||
+ av_dict_set(&ffmpeg->opts, "preset", "slow", 0);
|
||||
av_dict_set(&ffmpeg->opts, "tune", "zerolatency", 0);
|
||||
av_dict_set(&ffmpeg->opts, "crf", crf, 0);
|
||||
+ ffmpeg->ctx_codec->profile = FF_PROFILE_H264_HIGH;
|
||||
+ ffmpeg->ctx_codec->bit_rate = bit_rate;
|
||||
} else {
|
||||
/* The selection of 8000 in the else is a subjective number based upon viewing output files */
|
||||
if (ffmpeg->vbr > 0){
|
19
package/motioneye/allow-extpipe-motion-option.patch
Normal file
19
package/motioneye/allow-extpipe-motion-option.patch
Normal file
@ -0,0 +1,19 @@
|
||||
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',
|
||||
])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user