Forums » Tutorial and setups »
magewell pcie pro capture quad HDMI
Added by Brian Crawley over 4 years ago
Hello all, I use tvheadend (Ubuntu 18.04 server) with external HDMI encoders (TBS). The encoder send udp multicast to the tvheadend units (5) where it is piped using ffmpeg.
URL: pipe:////usr/bin/ffmpeg -loglevel fatal -i udp://@xxx.xxx.xxx.xxx:xxxxx -vcodec copy -acodec copy -f mpegts pipe:1
I have been asked to add local devices to some of the tvheadend (satellite receiver / android set top box), a magewell pro capture quad port HDMI pcie device was installed and seems to be working but I am unable to get the stream into tvheadend. I was hoping just changing the input part of the stream would do it but not so.
URL: pipe:////usr/bin/ffmpeg -loglevel fatal -i /dev/video0 -vcodec copy -acodec copy -f mpegts pipe:1
I added the stream in dvb inputs-networks(iptv automatic networks)-muxes(scan result OK) but I can not play the stream through the play button, vlc just does the knight rider thing bouncing back and forth no video. I mapped the service but there was no change. any help would be awesome
here is the info for the installed card:
mwcap-info -l
total: 4
device path firmware ver hardware ver driver ver alsa name device name
/dev/video0 1.32 A 1.3.4068 hw:0,0 00:00 Pro Capture Quad HDMI
/dev/video1 1.32 A 1.3.4068 hw:1,0 00:01 Pro Capture Quad HDMI
/dev/video2 1.32 A 1.3.4068 hw:2,0 00:02 Pro Capture Quad HDMI
/dev/video3 1.32 A 1.3.4068 hw:3,0 00:03 Pro Capture Quad HDMI
mwcap-info --info-input-video /dev/video0
Input common
Video input ............................ HDMI
Audio input ............................ HDMI
Auto scan .............................. Yes
AV Link ................................ Yes
Input video
Signal state ........................... Locked
Resolution ............................. 1920x1080p 59.95 Hz
Aspect ................................. 16:9
Total size ............................. 2200x1125
X offset ............................... 192
Y offset ............................... 41
Color space ............................ YUV BT.709
Quantization ........................... Limited
Saturation ............................. Limited
might have to set the video explicitly through ffmpeg ?
[video4linux2,v4l2 0x556e53005e00] Raw : yuyv422 : YUYV 4:2:2 : {48-2048, 1}x{32-2160, 1}
0x556e53005e00] Raw : uyvy422 : UYVY 4:2:2 : {48-2048, 1}x{32-2160, 1}
[video4linux2,v4l2
[video4linux2,v4l2 0x556e53005e00] Raw : nv12 : Y/CbCr 4:2:0 : {48-2048, 1}x{32-2160, 1}
0x556e53005e00] Raw : yuv420p : Planar YVU 4:2:0 : {48-2048, 1}x{32-2160, 1}
[video4linux2,v4l2
[video4linux2,v4l2 0x556e53005e00] Raw : yuv420p : Planar YUV 4:2:0 : {48-2048, 1}x{32-2160, 1}
0x556e53005e00] Raw : rgb24 : 24-bit RGB 8-8-8 : {48-2048, 1}x{32-2160, 1}
[video4linux2,v4l2
[video4linux2,v4l2 0x556e53005e00] Raw : 0rgb : 32-bit A/XRGB 8-8-8-8 : {48-2048, 1}x{32-2160, 1}
0x556e53005e00] Raw : bgr24 : 24-bit BGR 8-8-8 : {48-2048, 1}x{32-2160, 1}
[video4linux2,v4l2
[video4linux2,v4l2 0x556e53005e00] Raw : bgr0 : 32-bit BGRA/X 8-8-8-8 : {48-2048, 1}x{32-2160, 1}
0x556e53005e00] Raw : gray : 8-bit Greyscale : {48-2048, 1}x{32-2160, 1}
[video4linux2,v4l2
[video4linux2,v4l2 0x556e53005e00] Raw : gray16le : 16-bit Greyscale : {48-2048, 1}x{32-2160, 1}
0x556e53005e00] Raw : Unsupported : 32-bit A/XYUV 8-8-8-8 : {48-2048, 1}x{32-2160, 1}
[video4linux2,v4l2
/dev/video0: Immediate exit requested
Replies (18)
RE: magewell pcie pro capture quad HDMI - Added by saen acro over 4 years ago
Format your post¶
Cannot understand why you use this capture card,
with thing that stream is with bigger size then HD resolution.
RE: magewell pcie pro capture quad HDMI - Added by Brian Crawley over 4 years ago
it is the card I have. I would be open to other cards. the manual has an entry for linux using gst-launch in the desktop gui but I would like to use ffmpeg and pipe as it works for the udp stream. I will go through the manuals more.
gst-launch–1.0 v4l2src device=/dev/video0 ! video/x-raw,width=720,height=576,format=RGBx,framerate=30/1 ! videoconvert ! autovideosink
RE: magewell pcie pro capture quad HDMI - Added by saen acro over 4 years ago
tray udpixy
what say
ffprobefor stream?
RE: magewell pcie pro capture quad HDMI - Added by Brian Crawley over 4 years ago
ffprobe /dev/video0
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 24877.585720, bitrate: 1491646 kb/s
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 1491646 kb/s, 59.95 fps, 59.95 tbr, 1000k tbn, 1000k tbc
RE: magewell pcie pro capture quad HDMI - Added by saen acro over 4 years ago
Force colorspace there is a difference.
And start to use PRE button for formatting your posts.
RE: magewell pcie pro capture quad HDMI - Added by Brian Crawley over 4 years ago
got video working with pipe:////usr/bin/ffmpeg -i /dev/video0 -c:v libx264 -preset ultrafast -qp 0 -f mpegts pipe:1 will read about colorspace filter and how to adjust fps, resolution etc. as each hdmi input will be different I think. so ffprobe /dev/video shows the current output of the device while ffmpeg -list_formats all /dev/video0 shows what ffmpeg can read from the device. would be nice to set output on the card to reduce load on the cpu/ffmpeg but its working. will continue to read the documentation. will try live video feeds on all 4 HDMI ports from the shop tomorrow and report results do I have to specify an audio codec or does libx264 do both ? there is no sound on the HDMI feed here Thanks
RE: magewell pcie pro capture quad HDMI - Added by saen acro over 4 years ago
pipe:////usr/bin/ffmpeg -i /dev/video0 -c:v libx264 -preset ultrafast -qp 0 -f mpegts pipe:1
This PIPE not include audio
it need to be something as
pipe:///usr/bin/ffmpeg -i /dev/video0 -c:v libx264 -preset ultrafast -qp 0 -c:a libfdk_aac -b:a 128k -f mpegts pipe:1
RE: magewell pcie pro capture quad HDMI - Added by Brian Crawley over 4 years ago
k, will test as soon as its in the rack at the shop. Thanks
RE: magewell pcie pro capture quad HDMI - Added by Brian Crawley over 4 years ago
well I got the server in the rack and up, stripped the hdcp and the video is going nice. no audio though. device path firmware ver hardware ver driver ver alsa name device name /dev/video0 1.32 A 1.3.4068 hw:0,0 00:00 Pro Capture Quad HDMI Input audio Audio format ........................... 48000 Hz, 16 bit, LPCM Channel 1 & 2 .......................... Valid I tried to use alsa device hw:1,0 but there is no such device. i tried to reinstall the drivers no change. there is no audio card in this server. i did install alsa and tools and when i started the mixer it listed 00-00 pro capture card but no sound channels. i sent an email to magewell. pipe:////usr/bin/ffmpeg -f alsa -ac 2 -i hw:1,0 -i /dev/video1 -framerate 30 -s 1280:720 -c:v libx264 -preset veryfast -maxrate 4500k -bufsize 9000k -g 60 -c:a libfdk_aac -b:a 128k -f mpegts pipe:1 returns: ALSA lib pcm_hw.c:1826:(_snd_pcm_hw_open) Invalid value for card spawn: [alsa @ 0x560d4a09d180] cannot open audio device hw:1,0 (No such file or directory) spawn: hw:1,0: Input/output error iptv: stdin pipe unexpectedly closed: No data when i run arecord -l null Discard all samples (playback) or generate zero samples (capture) default:CARD=HDMI 00-00 Pro Capture Quad HDMI, Pro Capture PCM Default Audio Device sysdefault:CARD=HDMI 00-00 Pro Capture Quad HDMI, Pro Capture PCM Default Audio Device dmix:CARD=HDMI,DEV=0 00-00 Pro Capture Quad HDMI, Pro Capture PCM Direct sample mixing device dsnoop:CARD=HDMI,DEV=0 00-00 Pro Capture Quad HDMI, Pro Capture PCM Direct sample snooping device hw:CARD=HDMI,DEV=0 00-00 Pro Capture Quad HDMI, Pro Capture PCM Direct hardware device without any conversions plughw:CARD=HDMI,DEV=0 00-00 Pro Capture Quad HDMI, Pro Capture PCM Hardware device with all software conversions default:CARD=HDMI_1 00-01 Pro Capture Quad HDMI, Pro Capture PCM Default Audio Device sysdefault:CARD=HDMI_1 00-01 Pro Capture Quad HDMI, Pro Capture PCM Default Audio Device dmix:CARD=HDMI_1,DEV=0 00-01 Pro Capture Quad HDMI, Pro Capture PCM Direct sample mixing device dsnoop:CARD=HDMI_1,DEV=0 00-01 Pro Capture Quad HDMI, Pro Capture PCM Direct sample snooping device hw:CARD=HDMI_1,DEV=0 00-01 Pro Capture Quad HDMI, Pro Capture PCM Direct hardware device without any conversions plughw:CARD=HDMI_1,DEV=0 00-01 Pro Capture Quad HDMI, Pro Capture PCM Hardware device with all software conversions default:CARD=HDMI_2 00-02 Pro Capture Quad HDMI, Pro Capture PCM Default Audio Device sysdefault:CARD=HDMI_2 00-02 Pro Capture Quad HDMI, Pro Capture PCM Default Audio Device dmix:CARD=HDMI_2,DEV=0 00-02 Pro Capture Quad HDMI, Pro Capture PCM Direct sample mixing device dsnoop:CARD=HDMI_2,DEV=0 00-02 Pro Capture Quad HDMI, Pro Capture PCM Direct sample snooping device hw:CARD=HDMI_2,DEV=0 00-02 Pro Capture Quad HDMI, Pro Capture PCM Direct hardware device without any conversions plughw:CARD=HDMI_2,DEV=0 00-02 Pro Capture Quad HDMI, Pro Capture PCM Hardware device with all software conversions default:CARD=HDMI_3 00-03 Pro Capture Quad HDMI, Pro Capture PCM Default Audio Device sysdefault:CARD=HDMI_3 00-03 Pro Capture Quad HDMI, Pro Capture PCM Default Audio Device dmix:CARD=HDMI_3,DEV=0 00-03 Pro Capture Quad HDMI, Pro Capture PCM Direct sample mixing device dsnoop:CARD=HDMI_3,DEV=0 00-03 Pro Capture Quad HDMI, Pro Capture PCM Direct sample snooping device hw:CARD=HDMI_3,DEV=0 00-03 Pro Capture Quad HDMI, Pro Capture PCM Direct hardware device without any conversions plughw:CARD=HDMI_3,DEV=0 00-03 Pro Capture Quad HDMI, Pro Capture PCM Hardware device with all software conversions I did try hw:HDMI_1,0 still no device pipe closes thanks for your help B
RE: magewell pcie pro capture quad HDMI - Added by saen acro over 4 years ago
Use PRE to text you copy from terminal not to all text
Do you can get working solution any other way under linux with this capture card?
RE: magewell pcie pro capture quad HDMI - Added by Brian Crawley over 4 years ago
in linux I can get the video
Input #0, video4linux2,v4l2, from '/dev/video1': Duration: N/A, start: 71939.629989, bitrate: 745823 kb/s Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 745823 kb/s, 29.97 fps, 29.97 tbr, 1000k tbn, 1000k tbc
or I can get the audio
Input #0, alsa, from 'hw:1,0': Duration: N/A, start: 1586389697.839621, bitrate: 1536 kb/s Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
in linux on the command line I can get both and the audio/video is in sync too
ffmpeg -f alsa -thread_queue_size 1024 -ac 2 -i hw:0,0 -f video4linux2 -thread_queue_size 1024 -i /dev/video0 -s 1920x1080 -c:v libx264 -x264opts bitrate=2000 -profile:v baseline -preset superfast test1.mp4
in tvheadend i can pipe the video no problem
pipe:////usr/bin/ffmpeg -f video4linux2 -thread_queue_size 1024 -i /dev/video0 -s 1920x1080 -c:v libx264 -x264opts bitrate=2000 -profile:v baseline -preset superfast -f mpegts pipe:1
what I can't do is figure out the syntax/format to pipe both the audio and video together in a watchable stream in tvheadend.
the error is unable to pipe hw:0,0 or hw:0 or hw:HDMI,0 but they all work from the command line.
2020-04-09 18:16:28.721 spawn: ALSA lib pcm_hw.c:1826:(_snd_pcm_hw_open) Invalid value for card 2020-04-09 18:16:28.721 spawn: [alsa @ 0x5581a1861100] cannot open audio device hw:0 (No such file or directory) 2020-04-09 18:16:28.721 spawn: hw:0: Input/output error 2020-04-09 18:16:28.725 iptv: stdin pipe unexpectedly closed: No data or 2020-04-09 18:30:54.261 spawn: ALSA lib conf.c:4898:(parse_args) Unknown parameter 1 2020-04-09 18:30:54.261 spawn: ALSA lib conf.c:5031:(snd_config_expand) Parse arguments error: No such file or directory 2020-04-09 18:30:54.261 spawn: ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM hw:HDMI,0 2020-04-09 18:30:54.261 spawn: [alsa @ 0x55f6b1325100] cannot open audio device default:HDMI,0 (No such file or directory) 2020-04-09 18:30:54.261 spawn: hw:HDMI,0: Input/output error 2020-04-09 18:30:54.265 iptv: stdin pipe unexpectedly closed: No data
arecord -l shows
default:CARD=HDMI 00-00 Pro Capture Quad HDMI, Pro Capture PCM Default Audio Device sysdefault:CARD=HDMI 00-00 Pro Capture Quad HDMI, Pro Capture PCM Default Audio Device dmix:CARD=HDMI,DEV=0 00-00 Pro Capture Quad HDMI, Pro Capture PCM Direct sample mixing device dsnoop:CARD=HDMI,DEV=0 00-00 Pro Capture Quad HDMI, Pro Capture PCM Direct sample snooping device hw:CARD=HDMI,DEV=0 00-00 Pro Capture Quad HDMI, Pro Capture PCM Direct hardware device without any conversions plughw:CARD=HDMI,DEV=0 00-00 Pro Capture Quad HDMI, Pro Capture PCM Hardware device with all software conversions
why would it work on the command line but not in tvheadend. is it a permission issue ?
thanks
RE: magewell pcie pro capture quad HDMI - Added by saen acro over 4 years ago
Congratulations for your first corectly formated post.
pipe:////usr/bin/ffmpeg -f video4linux2 -thread_queue_size 1024 -i /dev/video0 -s 1920x1080 -c:v libx264 -x264opts bitrate=2000 -profile:v baseline -preset superfast -f mpegts pipe:1
remove extra "/" after pipe://
pipe:///usr/bin/ffmpeg -f video4linux2 -thread_queue_size 1024 -i /dev/video0 -s 1920x1080 -c:v libx264 -x264opts bitrate=2000 -profile:v baseline -preset superfast -f mpegts pipe:1
Try to make bash script with terminal command and pipe to TVH.
RE: magewell pcie pro capture quad HDMI - Added by Brian Crawley over 4 years ago
I'm gonna say typo on my part. should have been only 3 /
so i can write a script (4 total 1 each for the hdmi inputs) but I am not sure how to go about this.
I understand pipe to a file but do not want to fill the hard drive.
maybe something like
mkfifo hdmipipe1 pipe:///usr/bin/ffmpeg -f alsa -thread_queue_size 1024 -ac 2 -i hw:0 -f video4linux2 -thread_queue_size 1024 -i /dev/video0 -s 1920x1080 -c:v libx264 -x264opts bitrate=2000 -profile:v baseline -preset superfast -f mpegts hdmipipe1
then from tvheadend
pipe:///usr/bin/ffmpeg -i /dir/of/file/hdmipipe1 -vcodec copy -acodec copy -f mpegts pipe:1
will hdmipipe1 require .ts ?
I'll start reading the pipe manpage. Thanks
RE: magewell pcie pro capture quad HDMI - Added by saen acro over 4 years ago
No need to write anything to hard disk, there is some examples in this forum.
RE: magewell pcie pro capture quad HDMI - Added by Brian Crawley over 4 years ago
Thank you for all the help, including how to post :)
my final syntax was
ffmpeg -hide_banner -loglevel quiet -f alsa -thread_queue_size 1024 -ac 2 -i hw:0,0 -f video4linux2 -thread_queue_size 1024 -i /dev/video0 -s 1080x720 -c:v libx264 -x264opts bitrate=2000 -profile:v baseline -preset superfast -f mpegts /home/of/mkfifo/filename -y
I added the ffmpeg command to the systemd as a .service so it starts with the server and can be checked/restarted with sudo systemctl command
its called in tvheadend with
pipe:///usr/bin/ffmpeg -i /home/of/mkfifo/filename -vcodec copy -acodec copy -f mpegts pipe:1
should the audio be encoded ? the video gets c:v libx264 but dont think anything is done to the audio and it takes along time for the stream to sync and start up
might have to play with -bufsize -minrate and -maxrate but its working. Thanks
RE: magewell pcie pro capture quad HDMI - Added by saen acro over 4 years ago
"poor" command line
add some more parameters
(modeficate to your needs)
this use Nvidia GPU to transcode sd channel
ffmpeg -re -vsync passthrough -copytb 1 \
-hwaccel cuvid -hwaccel_device 0 -probesize 10000000 -analyzeduration 10000000 \
-fflags discardcorrupt+genpts+nobuffer -c:v mpeg2_cuvid -gpu 0 -deint adaptive -drop_second_field 1 -recv_buffer_size 67108864 \
-i alsa -thread_queue_size 1024 -ac 2 -i hw:0,0 -f video4linux2 -thread_queue_size 1024 -i /dev/video0 -s 1080x720 \
-filter_complex [0:i:0x2b4]split=outputs=1[map:v:0] -map [map:v:0] \
-c:v:0 hevc_nvenc -g 150 \
-flags:v +global_header+cgop -preset:v medium \
-profile:v:0 main -gpu 0 -b:v:0 500k -maxrate:v:0 1200k \
-bufsize:v:0 2400k -map 0:i:0x2b5 -c:a:0 libfdk_aac -ac 2 -ar 44100 -b:a:0 96k \
-metadata service_name=HDMI-1 \
-metadata service_provider=Quad-Capture \
-max_muxing_queue_size 512 -f pipe:1
-nostdin -hide_banner -loglevel info
RE: magewell pcie pro capture quad HDMI - Added by Brian Crawley over 4 years ago
Sorry for the delay in responding I was on an outside project for a bit. I'm starting to understand just how many options there are. I am going through
ffmpeg -h full and there is alot. i am reading about -filter_complex and the -map option.
I do not understand [0:i:0x2b4] and then later -map 0:i:0x2b5 are you calling the video input from the graphics card ? -hwaccel_device 0
split(audio and video inputs)=outputs(from audio and video after applied filter)=1(combined stream) ?
I will not use hardware(gpu), just memory and cpu this is a dedicated server for this capture card. Thanks
RE: magewell pcie pro capture quad HDMI - Added by saen acro over 4 years ago
This select exact audio stream remove it you can set this in STB
Video card is lot more potential then cpu for compression
cheapest Intel "i" series gen 2 and gen 3 can compress 8-10 HD channels with QSV, without high cpu load.