Skip to content

Commit

Permalink
Merge pull request #111 from QuPengfei/master
Browse files Browse the repository at this point in the history
update to 20.1 for ffmpeg and gst
  • Loading branch information
xwu2git authored Jan 13, 2020
2 parents f2bf34b + 094b04f commit 8fcad5b
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 24 deletions.
2 changes: 1 addition & 1 deletion ad-insertion/ad-segment/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FROM openvisualcloud/xeon-ubuntu1804-media-ffmpeg:19.10.1
FROM openvisualcloud/xeon-ubuntu1804-media-ffmpeg:20.1
RUN apt-get update && apt-get install -y -q youtube-dl bc wget && rm -rf /var/lib/apt/lists/*;

####
Expand Down
2 changes: 1 addition & 1 deletion ad-insertion/ad-transcode/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FROM openvisualcloud/xeon-ubuntu1804-media-ffmpeg:19.10.1
FROM openvisualcloud/xeon-ubuntu1804-media-ffmpeg:20.1

RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y -q --no-install-recommends nginx python3-tornado python3-urllib3 python3-requests python3-psutil python3-pip && rm -rf /var/lib/apt/lists/* && \
pip3 install 'kafka-python>=1.4.7' 'kazoo>=2.6.1'
Expand Down
2 changes: 1 addition & 1 deletion ad-insertion/analytics/VCAC-A/ffmpeg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ssai_analytics_ffmpeg_vcac-a

ARG base_name=openvisualcloud/vcaca-ubuntu1804-analytics-ffmpeg:19.11
ARG base_name=openvisualcloud/vcaca-ubuntu1804-analytics-ffmpeg:20.1
FROM ${base_name}

# Fetch python3 and Install python3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "emotion_recognition",
"version": 1,
"type": "FFmpeg",
"template":"-flags unaligned -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i \"{source[uri]}\" -vf \"detect=model={models[face_detection_retail][1][network]}:model_proc=\"{models[face_detection_retail][1][proc]}\":interval=\"{parameters[every-nth-frame]}\":device=HDDL,classify=model=\"{models[emotion_recognition][1][network]}\":model_proc=\"{models[emotion_recognition][1][proc]}\":device=HDDL\"",
"template":"-flags unaligned -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i \"{source[uri]}\" -vf \"detect=model={models[face_detection_retail][1][network]}:model_proc=\"{models[face_detection_retail][1][proc]}\":interval=\"{parameters[every-nth-frame]}\":device=HDDL,classify=model=\"{models[emotion_recognition][1][network]}\":model_proc=\"{models[emotion_recognition][1][proc]}\":device=HDDL,metaconvert=converter=json:method=all:source=NULL:tags=NULL\"",
"description":"Emotion Recognition",
"parameters": {
"type" : "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "face_recognition",
"version": 1,
"type": "FFmpeg",
"template":"-flags unaligned -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i \"{source[uri]}\" -vf \"detect=model={models[face_detection_retail][1][network]}:model_proc=\"{models[face_detection_retail][1][proc]}\":interval=\"{parameters[every-nth-frame]}\":device=HDDL,classify=model=\"{models[face_reidentification][1][network]}\":model_proc=\"{models[face_reidentification][1][proc]}\":device=HDDL\",identify=gallery=\"/home/gallery/face_gallery_FP16/gallery.json\"",
"template":"-flags unaligned -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i \"{source[uri]}\" -vf \"detect=model={models[face_detection_retail][1][network]}:model_proc=\"{models[face_detection_retail][1][proc]}\":interval=\"{parameters[every-nth-frame]}\":device=HDDL,classify=model=\"{models[face_reidentification][1][network]}\":model_proc=\"{models[face_reidentification][1][proc]}\":device=HDDL\",identify=gallery=\"/home/gallery/face_gallery_FP16/gallery.json,metaconvert=converter=json:method=all:source=NULL:tags=NULL\"",
"description":"Face Recognition",
"parameters": {
"type" : "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "object_detection",
"version": 1,
"type": "FFmpeg",
"template":"-flags unaligned -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i \"{source[uri]}\" -vf \"detect=model={models[object_detection][1][network]}:device=HDDL:model_proc=\"{models[object_detection][1][proc]}\":interval={parameters[every-nth-frame]}\"",
"template":"-flags unaligned -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i \"{source[uri]}\" -vf \"detect=model={models[object_detection][1][network]}:device=HDDL:model_proc=\"{models[object_detection][1][proc]}\":interval={parameters[every-nth-frame]},metaconvert=converter=json:method=all:source=NULL:tags=NULL\"",
"description": "Object Detection",
"parameters": {
"type" : "object",
Expand Down
4 changes: 1 addition & 3 deletions ad-insertion/analytics/VCAC-A/gst/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# ssai_analytics_gst_vcac-a

FROM openvisualcloud/vcaca-ubuntu1804-analytics-gst:19.11
FROM openvisualcloud/vcaca-ubuntu1804-analytics-gst:20.1

# Fetch python3 and Install python3
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y -q --no-install-recommends libjson-c3 python3-gst-1.0 python3-jsonschema python3-gi python3-requests python3-tornado python3-pip python3-setuptools python3-wheel && rm -rf /var/lib/apt/lists/* && \
pip3 install 'kafka-python>=1.4.7' 'kazoo>=2.6.1'

#COPY ./app/server/requirements.txt /

COPY app /home/
COPY models/ /home/models/
COPY gallery/ /home/gallery/
Expand Down
2 changes: 1 addition & 1 deletion ad-insertion/analytics/Xeon/ffmpeg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ssai_analytics_ffmpeg_xeon

From openvisualcloud/xeon-ubuntu1804-analytics-ffmpeg:19.11
From openvisualcloud/xeon-ubuntu1804-analytics-ffmpeg:20.1

# Fetch python3 and Install python3
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y -q --no-install-recommends python3-gst-1.0 python3-jsonschema python3-pip && rm -rf /var/lib/apt/lists/* && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "emotion_recognition",
"version": 1,
"type": "FFmpeg",
"template":"-i \"{source[uri]}\" -vf \"detect=model={models[face_detection_retail][1][network]}:model_proc=\"{models[face_detection_retail][1][proc]}\":interval=\"{parameters[every-nth-frame]}\":device=CPU,classify=model=\"{models[emotion_recognition][1][network]}\":model_proc=\"{models[emotion_recognition][1][proc]}\":device=CPU\"",
"template":"-i \"{source[uri]}\" -vf \"detect=model={models[face_detection_retail][1][network]}:model_proc=\"{models[face_detection_retail][1][proc]}\":interval=\"{parameters[every-nth-frame]}\":device=CPU,classify=model=\"{models[emotion_recognition][1][network]}\":model_proc=\"{models[emotion_recognition][1][proc]}\":device=CPU,metaconvert=converter=json:method=all:source=NULL:tags=NULL\"",
"description":"Emotion Recognition",
"parameters": {
"type" : "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "face_recognition",
"version": 1,
"type": "FFmpeg",
"template":"-i \"{source[uri]}\" -vf \"detect=model={models[face_detection_retail][1][network]}:model_proc=\"{models[face_detection_retail][1][proc]}\":interval=\"{parameters[every-nth-frame]}\":device=CPU,classify=model=\"{models[face_reidentification][1][network]}\":model_proc=\"{models[face_reidentification][1][proc]}\":device=CPU,identify=gallery=\"/home/gallery/face_gallery_FP32/gallery.json\"\"",
"template":"-i \"{source[uri]}\" -vf \"detect=model={models[face_detection_retail][1][network]}:model_proc=\"{models[face_detection_retail][1][proc]}\":interval=\"{parameters[every-nth-frame]}\":device=CPU,classify=model=\"{models[face_reidentification][1][network]}\":model_proc=\"{models[face_reidentification][1][proc]}\":device=CPU,identify=gallery=\"/home/gallery/face_gallery_FP32/gallery.json\",metaconvert=converter=json:method=all:source=NULL:tags=NULL\"",
"description":"Face Recognition Pipeline",
"parameters": {
"type" : "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "object_detection",
"version": 1,
"type": "FFmpeg",
"template":"-i \"{source[uri]}\" -vf \"detect=model={models[object_detection][1][network]}:model_proc=\"{models[object_detection][1][proc]}\":interval={parameters[every-nth-frame]}:device=CPU\"",
"template":"-i \"{source[uri]}\" -vf \"detect=model={models[object_detection][1][network]}:model_proc=\"{models[object_detection][1][proc]}\":interval={parameters[every-nth-frame]}:device=CPU,metaconvert=converter=json:method=all:source=NULL:tags=NULL\"",
"description": "Object Detection",
"parameters": {
"type" : "object",
Expand Down
2 changes: 1 addition & 1 deletion ad-insertion/analytics/Xeon/gst/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ssai_analytics_gst_xeon

FROM openvisualcloud/xeon-ubuntu1804-analytics-gst:19.11
FROM openvisualcloud/xeon-ubuntu1804-analytics-gst:20.1

# Fetch python3 and Install python3
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y -q python3-gst-1.0 python3-jsonschema python3-pip ca-certificates && rm -rf /var/lib/apt/lists/* && \
Expand Down
21 changes: 18 additions & 3 deletions ad-insertion/analytics/app/modules/FFmpegPipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,23 @@ def _add_default_models(self,args):
device = FFmpegPipeline.DEVICEID_MAP[int(filter_params['device'])]
filter_params["model"] = ModelManager.get_default_network_for_device(device,filter_params["model"])
new_filters.append(self._join_filter_params(filter_params))
elif (filter_params['type'] == "metaconvert"):
# use the file to send the tags info to ffmpeg
tmp_file = "/tmp/timestamp"
if "tags" in self.request:
try:
tmp_tags=""
for key in self.request["tags"]:
#filter_params["tags"] = "{\"%s\":%s}" % (key, self.request["tags"][key])
tmp_tags = "{\"%s\":%s}" % (key, self.request["tags"][key])
with open(tmp_file,'w') as f:
f.write(tmp_tags)
except Exception:
logger.error("Error adding tags")
source_uri ="source=" + "'" + self.request["source"]["uri"].replace(":","\\:") + "'"
filter_params_str = self._join_filter_params(filter_params).replace("source=NULL",source_uri)
filter_params_str = filter_params_str.replace("tags=NULL","tags=file|"+tmp_file)
new_filters.append(filter_params_str)
else:
new_filters.append(_filter)
args[vf_index+1] =','.join(new_filters)
Expand All @@ -164,9 +181,7 @@ def start(self):
self._ffmpeg_launch_string = string.Formatter().vformat(self.template, [], self.request)
args = ['ffmpeg']
args.extend(shlex.split(self._ffmpeg_launch_string))
iemetadata_args = ["-f", "iemetadata", "-source_url", self.request["source"]["uri"]]

self._add_tags(iemetadata_args)
iemetadata_args = ["-f", "metapublish", "-method", "1", "-output_format", "stream"]

if 'destination' in self.request:
if self.request['destination']['type'] == "kafka":
Expand Down
2 changes: 1 addition & 1 deletion ad-insertion/analytics/app/modules/GstGVAJSONMeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from ctypes import * # pylint: disable=unused-wildcard-import

clib = CDLL("/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvideoanalyticsmeta.so")
clib = CDLL("/usr/local/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvideoanalyticsmeta.so")

# json meta

Expand Down
8 changes: 4 additions & 4 deletions common/abr_hls_dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def check_renditions(frame_height, renditions=renditions_sample):
return min_res

def GetABRCommand(in_file, target, streaming_type, renditions=renditions_sample, duration=2,segment_num=0,fade_type=None,content_type=None):
ffprobe_cmd = ["/usr/bin/ffprobe", "-v", "quiet", "-print_format", "json", "-show_streams",in_file]
ffprobe_cmd = ["ffprobe", "-v", "quiet", "-print_format", "json", "-show_streams",in_file]

process_id = subprocess.Popen(ffprobe_cmd,stdout=subprocess.PIPE)
# the `multiprocessing.Process` process will wait until
Expand Down Expand Up @@ -77,7 +77,7 @@ def GetABRCommand(in_file, target, streaming_type, renditions=renditions_sample,

cmd = []
cmd_abr = []
cmd_base = ["/usr/bin/ffmpeg", "-hide_banner", "-y","-i", in_file]
cmd_base = ["ffmpeg", "-hide_banner", "-y","-i", in_file]
if clip_a_duration == 0 and content_type == "ad":
cmd_base += ["-f", "lavfi", "-i", "anullsrc=channel_layout=stereo:sample_rate="+str(44100)]
cmd_misc = ["-hide_banner", "-y"]
Expand Down Expand Up @@ -168,7 +168,7 @@ def GetABRCommand(in_file, target, streaming_type, renditions=renditions_sample,

def GetFadeCommand(in_file, target, fade_type):
# ffprobe -v quiet -print_format json -show_streams
ffprobe_cmd = ["/usr/bin/ffprobe", "-v", "quiet", "-print_format", "json", "-show_streams",in_file]
ffprobe_cmd = ["ffprobe", "-v", "quiet", "-print_format", "json", "-show_streams",in_file]

process_id = subprocess.Popen(ffprobe_cmd,stdout=subprocess.PIPE)
# the `multiprocessing.Process` process will wait until
Expand All @@ -192,7 +192,7 @@ def GetFadeCommand(in_file, target, fade_type):
a_st = (int)(clip_a_duration - duration)

cmd = []
cmd_base = ["/usr/bin/ffmpeg", "-i", in_file]
cmd_base = ["ffmpeg", "-i", in_file]
cmd_fade_in_out = ["-af", "afade="+fade_type+":"+"st="+str(a_st)+":"+"d="+str(duration), "-c:v", "copy"]

cmd = cmd_base + cmd_fade_in_out
Expand Down
2 changes: 1 addition & 1 deletion content-provider/archive/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FROM openvisualcloud/xeon-ubuntu1804-media-ffmpeg:19.10.1
FROM openvisualcloud/xeon-ubuntu1804-media-ffmpeg:20.1
RUN apt-get update && apt-get install -y -q youtube-dl bc wget && rm -rf /var/lib/apt/lists/*;

####
Expand Down
2 changes: 1 addition & 1 deletion content-provider/transcode/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FROM openvisualcloud/xeon-ubuntu1804-media-ffmpeg:19.10.1
FROM openvisualcloud/xeon-ubuntu1804-media-ffmpeg:20.1

RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y -q --no-install-recommends nginx python3-tornado python3-urllib3 python3-requests python3-psutil python3-pip && rm -rf /var/lib/apt/lists/* && \
pip3 install 'kafka-python>=1.4.7' 'kazoo>=2.6.1'
Expand Down

0 comments on commit 8fcad5b

Please sign in to comment.