linux gstreamer and blackmagic cards.

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Federico Allegretti

  • Posts: 17
  • Joined: Tue Aug 26, 2014 10:39 am

linux gstreamer and blackmagic cards.

PostMon Nov 06, 2017 5:40 pm

hello everybody.
I'm trying to do some simply video playback of video files (mixed SD/HD videos) to the composite video out of my Intensity pro card (not the 4k).

i generally use gstreamer to handle multimedia data.

this pipelinie works:
gst-launch-1.0 -v videotestsrc pattern=snow ! decklinkvideosink

but this other not ...
gst-launch-1.0 filesrc location=/home/v1p3r/Videos/testvideoh264-aac.mkv ! decklinkvideosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(2950): gst_base_src_loop (): /GstPipeline:pipeline0/GstFileSrc:filesrc0:
streaming stopped, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...


i made those tests using playbin .... but no luck:
gst-launch-1.0 playbin uri=file:///home/v1p3r/Videos/editoria_galileo.mkv video-sink=decklinkvideosink audio-sink=decklinkaudiosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Redistribute latency...
Redistribute latency...
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstMatroskaDemux:matroskademux0: Internal data stream error.
Additional debug info:
matroska-demux.c(4768): gst_matroska_demux_loop (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstMatroskaDemux:matroskademux0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...


any idea?
Offline

Dave Johnstone

  • Posts: 223
  • Joined: Mon Dec 08, 2014 11:12 am
  • Location: Adelaide

Re: linux gstreamer and blackmagic cards.

PostMon Nov 06, 2017 11:34 pm

The Decklink cards only accept uncompressed frames and in a few pixel formats so you have to set your pipeline to provide this. I have also found it is required to set the mode of the card to the format of the video file. Try this pipeline (I am assuming 1080i/50 here).

gst-launch-1.0 uridecodebin uri=file:///path/to/video.file ! interlace field-pattern=1 ! autovideoconvert ! decklinkvideosink mode=11

Regards,

Dave.
Freelance Television Broadcast Engineer
and Software Programmer.
Offline

Federico Allegretti

  • Posts: 17
  • Joined: Tue Aug 26, 2014 10:39 am

Re: linux gstreamer and blackmagic cards.

PostWed Nov 08, 2017 11:14 am

thanks for the kind reply.
00001.mts is a 1080p25 with ac3 audio (recorded by a panasonic camcorder), but no way, i got always errors:

gst-launch-1.0 uridecodebin uri=file:///home/myusername/Videos/00001.MTS ! interlace field-pattern=1 ! autovideoconvert ! decklinkvideosink mode=11
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstTSDemux:tsdemux0: Internal data stream error.
Additional debug info:
mpegtsbase.c(1613): mpegts_base_loop (): /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstTSDemux:tsdemux0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
Offline

Dave Johnstone

  • Posts: 223
  • Joined: Mon Dec 08, 2014 11:12 am
  • Location: Adelaide

Re: linux gstreamer and blackmagic cards.

PostWed Nov 08, 2017 11:31 pm

You will need to modify the pipeline to play any particular frame format, 1080p/25 is mode 8 and you shouldn't have the interlace element. I suggest you check the mode list with gst-inspect-1.0 decklinkvideosink to select the correct video mode for your video file. The Decklink cards won't do any conversions for you, you have to provide uncompressed video and audio so you will also need to decode the AC3 audio.

It is always worth checking GStreamer can correctly decode the stream before passing it to the decklinkvideosink. Try your file with xvimagesink and see if your video plays on screen.

Regards,

Dave.
Freelance Television Broadcast Engineer
and Software Programmer.
Offline

Federico Allegretti

  • Posts: 17
  • Joined: Tue Aug 26, 2014 10:39 am

Re: linux gstreamer and blackmagic cards.

PostFri Nov 10, 2017 5:45 pm

i was wondering where i could find those modes :D

and google was not success in this case.

gst-inspect-1.0 decklinkvideosink was a really good hint for the gstreamer nubs like me :D

I test with the right mode the 1080 25p (mode=8) and something appears on screen and something cames from tv speakers, but only for a second and is garbage.

gst-launch-1.0 playbin uri=file:///home/v1p3r/Videos/00001.MTS video-sink="decklinkvideosink mode=8" audio-sink="audioconvert ! audio/x-raw, channels=2 rate=48000 ! decklinkaudiosink"

After that the tv screen became blue, remains blue also when pipeline ends (have to switch video output modes on the blackmagic desktop video setup utility).

Seems quite like setting the "mode" switches the video output of the intensity pro from composite video to component ....

-----

If i wish to render ALWAY a video at a fixer resolution (don't know where it came from) to a specif video output of the decklink.
Could i force gstreamer to pass to the sink the correct video mode (i set for the customer setup? pal, 1080 720 etc?), scale and adapt it?

for standard definition pal on composite video, i suppose video-sink="videoconvert ! video/x-raw,format=YUY2 ! videoconvert ! decklinkvideosink video-format=1 mode=3" audio-sink="audioconvert ! audio/x-raw, channels=2 rate=48000 ! decklinkaudiosink"

blackmagic 8bit-yuv is gstreamer YUY2 ?
Offline

Dave Johnstone

  • Posts: 223
  • Joined: Mon Dec 08, 2014 11:12 am
  • Location: Adelaide

Re: linux gstreamer and blackmagic cards.

PostTue Nov 14, 2017 12:13 am

Unless your card has a hardware down-converter, I wouldn't expect much from the composite socket when running HD video. Did you try outputting to the xvimagesink (just to prove your system has all the required plugins)?

You should be able to design a player with a fixed output mode as there is a videoscale element for this (and perhaps videorate will also be needed). You will probably need a dynamic pipeline to switch elements such as interlace in and out as required. Take a look at "Basic Tutorial 3" on the GStreamer website if you haven't already.

Another helpful debugging tool is the pipeline graphs, these can be generated by setting the environment variable GST_DEBUG_DUMP_DOT_DIR to a path where you have write access. They will give you a graphical representation of your pipeline when viewed with Xdot or similar.

Regards,

Dave.
Freelance Television Broadcast Engineer
and Software Programmer.
Offline

Federico Allegretti

  • Posts: 17
  • Joined: Tue Aug 26, 2014 10:39 am

Re: linux gstreamer and blackmagic cards.

PostTue Nov 14, 2017 12:43 pm

yes the xvimagesink runs well (really i tested autovideosink nad autoaudiosink).

At the moment i'm writing an open source video server based on the gstreamer framework and the idea was to make it indipendent to the clip/content resolution.

The user chooses the preferred video output (hdmi or component or composite - svideo) and the output desidered resolution (pal/ntsc - 720 - 1080 - 4k) and the software makes the upscale/downscale on the fly.

so i had to fix the output and handle the incoming video contents.

But at the moment i'm stuck in the plain "playbacking" of the files.

PS: if i set the right "mode" for the incoming video i noticed that the BM borad switches the video output settings (i can see it in the desktop video util). It's a bug or a feature?
Offline

Dave Johnstone

  • Posts: 223
  • Joined: Mon Dec 08, 2014 11:12 am
  • Location: Adelaide

Re: linux gstreamer and blackmagic cards.

PostTue Nov 14, 2017 9:39 pm

The card will output all supported formats simultaneously (SDI/HDMI/Component) , but I'd expect composite and S-Video to only function in SD modes (as these are analogue SD formats). If you can share a sample of the file you are trying to play, I can see what is needed to play it on my system (HD Extreme 3D). If it plays on your local sink then it will most likely just need some caps filtering/setting, the Decklink cards are very fussy regarding pixel and audio formats.

Yes, the card will switch to the requested format and it will be reflected in the Desktop Video Setup app, this is normal.

Regards,

Dave.
Freelance Television Broadcast Engineer
and Software Programmer.
Offline

Federico Allegretti

  • Posts: 17
  • Joined: Tue Aug 26, 2014 10:39 am

Re: linux gstreamer and blackmagic cards.

PostWed Nov 15, 2017 4:09 pm

that's a link to the 1080 25p file i wish to render ALSO (downscaled) to composite video output:

https://mega.nz/#!k5cGEJoR!9BiSBNgeowQy ... Pai0EtZkZk

thank's for your time and effort to help me out.

Cheers

Federico
Offline

Dave Johnstone

  • Posts: 223
  • Joined: Mon Dec 08, 2014 11:12 am
  • Location: Adelaide

Re: linux gstreamer and blackmagic cards.

PostThu Nov 16, 2017 10:32 pm

I've had a chance to try your file and GStreamer appears to have an issue detecting the interlace format. Forcing the format to progressive with a "capssetter" element will mask this problem.

This pipeline works on my system in the supported progressive HD modes (1080p and 720p) in all framerates, for interlaced modes you will have to add an interlace element.

Code: Select all
gst-launch-1.0 uridecodebin uri=file://'/Storage/00001.MTS' name=demux ! capssetter caps=\"video/x-raw,interlace-mode=progressive\" ! videorate ! autovideoconvert ! videoscale ! decklinkvideosink mode=8 demux. ! audioconvert ! decklinkaudiosink

Regards,

Dave.
Freelance Television Broadcast Engineer
and Software Programmer.
Offline

Federico Allegretti

  • Posts: 17
  • Joined: Tue Aug 26, 2014 10:39 am

Re: linux gstreamer and blackmagic cards.

PostThu Dec 28, 2017 7:28 pm

Thanks Dave for your time, but i suppose there is something strange in my rig.

nothing from the intensity pro composite video output.

ok if tested like usual:
gst-launch-1.0 -v videotestsrc ! decklinkvideosink

after that command black magic says analog video is svideo/composite

scrambled video for a sec with:
gst-launch-1.0 uridecodebin uri=file://'/home/v1p3r/Videos/00001.MTS' name=demux ! capssetter caps=\"video/x-raw,interlace-mode=progressive\" ! videorate ! autovideoconvert ! videoscale ! decklinkvideosink mode=8 demux. ! audioconvert ! decklinkaudiosink

after that command, the analog video (from black magick user interface) switchs to component

seems it switches to use the right moe for the video i wish to playback ....

But i also set the HD->SD downscaling in teh same black magick device setup tool ....

My idea is that maybe i have to:
1) get the video
2) if not SD downscale it with the right gstreamer plug in
3) pass it to the decklink consumer ...

in this case the frames are SD and teh plug do not try to switch the output mode ...

could be correct?
Offline

Federico Allegretti

  • Posts: 17
  • Joined: Tue Aug 26, 2014 10:39 am

Re: linux gstreamer and blackmagic cards.

PostWed Apr 03, 2019 3:33 pm

hello everybody.

I made some changes to my app and now seems more "robust".

Default mode for my linux application is standard definition pal, so decklink mode 3.

and current working (80% of the time) pipeline is:
uridecodebin uri=file:///path/of/video/file.extension name=decode decode. ! deinterlace ! autovideoconvert ! interlace field-pattern=2:2 ! videoconvert ! video/x-raw,format=UYVY ! videoscale ! video/x-raw,width=720,height=576 ! videorate ! video/x-raw,framerate=25/1 ! decklinkvideosink mode=3 decode. !audioconvert ! audio/x-raw, format=S32LE, channels=2 ! audioresample ! audio/x-raw, rate=48000 ! decklinkaudiosink

So i deinterlace ALL the content then REinterlace it (mode 3 is pal 50i), scale it to 720x576 (also content is already pal). also framerate is forced to 25fps and audio forced to the strict formats of blackmagic cards :D

some content (maybe for missing timestamps) are playbed with accelerated video, but .... is a source problem i suppose is not easy to fix at runtime.

Hope those info could help other users.

Cheers,

Federico

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 10 guests