Skip to content

Commit

Permalink
move all the video rate/scale/convert to --video-elements, remove dei…
Browse files Browse the repository at this point in the history
…nterlace as it makes the loop wobblwobble.
  • Loading branch information
CarlFK committed May 23, 2019
1 parent ddf0295 commit 80f9afb
Showing 1 changed file with 37 additions and 64 deletions.
101 changes: 37 additions & 64 deletions ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,15 @@

def mk_video_src(args, videocaps):
# make video source part of pipeline

d = {
'attribs': args.video_attribs,
'videocaps': videocaps,
}

if args.monitor:
if args.debug:
d['monitor'] = """tee name=t ! queue !
videoconvert ! fpsdisplaysink sync=false
t. ! queue !"""
else:
d['monitor'] = """tee name=t ! queue !
videoconvert ! autovideosink sync=false
t. ! queue !"""
else:
d['monitor'] = ""
# args come from command line
# videocaps come from voctocore

if args.video_source == 'dv':
video_src = """
dv1394src name=videosrc {attribs} !
dvdemux name=demux !
queue max-size-time=4000000000 !
dvdec !
{monitor}
deinterlace mode=interlaced !
videoconvert !
videorate !
videoscale !
"""

elif args.video_source == 'hdv':
Expand All @@ -77,11 +57,6 @@ def mk_video_src(args, videocaps):
tsdemux !
queue max-size-time=4000000000 !
decodebin !
{monitor}
deinterlace mode=interlaced !
videorate !
videoscale !
videoconvert !
"""

elif args.video_source == 'hdmi2usb':
Expand All @@ -92,30 +67,18 @@ def mk_video_src(args, videocaps):
queue max-size-time=4000000000 !
image/jpeg,width=1280,height=720 !
jpegdec !
{monitor}
videoconvert !
videoscale !
videorate !
"""

elif args.video_source == 'ximage':
# startx=0 starty=0 endx=1919 endy=1079 !
video_src = """
ximagesrc {attribs} name=videosrc
use-damage=false !
{monitor}
videoconvert !
videorate !
videoscale !
"""

elif args.video_source == 'blackmagic':
video_src = """
decklinkvideosrc {attribs} !
{monitor}
videoconvert !
videorate !
videoscale !
"""
# yadif !
# deinterlace
Expand All @@ -125,52 +88,56 @@ def mk_video_src(args, videocaps):
multifilesrc {attribs}
caps="image/png" !
pngdec !
videoscale !
{monitor}
videoconvert !
"""

elif args.video_source == 'file':
video_src = """
multifilesrc {attribs} !
decodebin name=src
src. !
{monitor}
queue !
deinterlace mode=interlaced !
videoconvert !
videoscale !
videorate !
"""

elif args.video_source == 'test':

# things to render as text ontop of test video
d['hostname'] = socket.gethostname()

video_src = """
videotestsrc name=videosrc {attribs} !
videotestsrc name=videosrc {attribs} !
"""
# things to render as text ontop of test video
video_src += """
clockoverlay
text="Source: {hostname}\nCaps: {videocaps}\nAttribs: {attribs}\n"
halignment=left line-alignment=left !
{monitor}
"""
""".format(hostname=socket.gethostname(),
videocaps=videocaps,
attribs=args.video_attribs)

elif args.video_source == 'spacescope':
# Stereo visualizer
# pair up with test beep for a handy AV sync test.
video_src = """
audio_tee. ! queue !
spacescope shader=none style=lines {attribs} !
{monitor}
videoconvert !
queue !
"""
"""

if args.monitor:
if args.debug:
videosink="fpsdisplaysink"
else:
videosink="autovideosink"

video_src += "{videocaps} !\n"
video_src += """
tee name=t ! queue !
videoconvert ! {videosink} sync=false
t. ! queue !
""".format(videosink=videosink)

video_src = video_src.format(**d)
if args.video_elements:
video_src += args.video_elements + " !\n"

video_src += videocaps + " !\n"

video_src = video_src.format(attribs=args.video_attribs)

return video_src

Expand All @@ -190,7 +157,6 @@ def mk_audio_src(args, audiocaps):
audio_src = """
demux.audio !
queue !
audioconvert !
"""

elif args.audio_source == 'file':
Expand All @@ -199,9 +165,6 @@ def mk_audio_src(args, audiocaps):
audio_src = """
src. !
queue !
audioconvert !
audioresample !
audiorate !
"""


Expand Down Expand Up @@ -428,6 +391,11 @@ def get_args():
type=int,
help="delay video by this many milliseconds")

parser.add_argument(
'--video-elements', action='store',
default='videoconvert ! videorate ! videoscale',
help="gst video elments ! after src")

parser.add_argument(
'--audio-source', action='store',
choices=['dv', 'hdv', 'file',
Expand All @@ -446,9 +414,14 @@ def get_args():
type=int,
help="delay audio by this many milliseconds")

parser.add_argument(
'--audio-elements', action='store',
default="audioconvert ! audioresample ! audiorate",
help="gst audio elments ! after src")

parser.add_argument(
'-m', '--monitor', action='store_true',
help="fps display sink")
help="local display sink")

parser.add_argument(
'--host', action='store',
Expand Down

0 comments on commit 80f9afb

Please sign in to comment.