Well I finally had some time to test things.
Using this command that i found on another post, I managed to open the stream from the card using the Blackmagic:
Code: Select all
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -vvv dshow:// :dshow-vdev="Decklink Video Capture" :dshow-adev="Decklink Audio Capture" :dshow-size="1920x1080" :dshow-aspect-ratio=16\:9 :dshow-chroma=UYVY :dshow-fps=25 :no-dshow-config :no-dshow-tuner :live-caching=1000"
This works Video and audio, no problems.
If I try to do anything after opening, weird things start to happen.
Any duplicate or anything that I add after that code causes the video display to freeze either with a black frame or a fixed (assuming first) frame from the camera but whatever else you had running (transcode, rtp, dump file) keeps running in the back most of the times.
I tried every step by itself and using different combinations of duplicates and chains.
This code summarizes most of the things I tried:
Code: Select all
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -vvv dshow:// :dshow-vdev="Decklink Video Capture" :dshow-adev="Decklink Audio Capture" :dshow-size="1920x1080" :dshow-aspect-ratio=16\:9 :dshow-chroma=UYVY :dshow-fps=25 :no-dshow-config :no-dshow-tuner :live-caching=1000 --sout="#transcode{venc=x264,vcodec=h264,vb=2200,fps=25,width=640, height=480,acodec=mp3,ab=128,channels=2,samplerate=44100}:duplicate{dst=std{access=file{append},mux=ts,dst="g:\prueba2.mp4"},dst=std{access=udp,mux=ts,dst=127.0.0.1:1234}} --sout-keep"
Log:
Code: Select all
main debug: VLC media player - 2.1.2 Rincewind
main debug: Copyright © 1996-2013 the VideoLAN team
main debug: revision 2.1.2-0-ga4c4876
main debug: configured with ../extras/package/win32/../../../configure '--enable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-
theora' '--enable-twolame' '--enable-quicktime' '--enable-avcodec' '--enable-merge-ffmpeg' '--enable-dca' '--enable-mpc' '--enable-libass' '--enable-x264'
'--enable-schroedinger' '--enable-realrtsp' '--enable-live555' '--enable-dvdread' '--enable-shout' '--enable-goom' '--enable-caca' '--disable-sdl' '--
enable-qt' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-nls' '--disable-dirac' '--
host=i686-w64-mingw32' 'host_alias=i686-w64-mingw32'
x264 warning: invalid DTS: PTS is less than DTS
x264 warning: invalid DTS: PTS is less than DTS
x264 warning: invalid DTS: PTS is less than DTS
mux_ts warning: packet with too strange dts (dts=24210278356,old=36314887356,pcr=36314887356)
mux_ts warning: packet with too strange dts (dts=24210278356,old=36314887356,pcr=36314887356)
main warning: late buffer for mux input (1266644)
mux_ts warning: packet with too strange dts (dts=12105699913,old=24210318268,pcr=24210318356)
main warning: late buffer for mux input (1266644)
mux_ts warning: packet with too strange dts (dts=12105699913,old=24210318268,pcr=24210318356)
main warning: late buffer for mux input (1267644)
main warning: late buffer for mux input (1269644)
main warning: late buffer for mux input (1266644)
main warning: late buffer for mux input (1267644)
access_output_udp debug: late packet for UDP input (867644)
access_output_udp debug: late packet for UDP input (856074)
access_output_udp debug: late packet for UDP input (844504)
access_output_udp debug: late packet for UDP input (832934)
access_output_udp debug: packet has been sent too late (867644)
access_output_udp debug: late packet for UDP input (821364)
access_output_udp debug: packet has been sent too late (684533)
access_output_udp debug: packet has been sent too late (679672)
main warning: late buffer for mux input (1268644)
main warning: late buffer for mux input (1268644)
main warning: late buffer for mux input (1266644)
main warning: late buffer for mux input (1266644)
main debug: incoming request - stopping current input
main warning: late buffer for mux input (1268644)
main warning: late buffer for mux input (1268644)
main debug: control: stopping input
main debug: incoming request - stopping current input
main debug: finished input
main debug: removing module "rawvideo"
main debug: killing decoder fourcc `UYVY', 0 PES in FIFO
main debug: removing a sout input (sout_input:029398a0)
main warning: late buffer for mux input (1577644)
main warning: late buffer for mux input (1577644)
main warning: late buffer for mux input (1537644)
main warning: late buffer for mux input (1539644)
access_output_udp debug: late packet for UDP input (1143811)
access_output_udp debug: late packet for UDP input (1139354)
access_output_udp debug: late packet for UDP input (1137319)
access_output_udp debug: late packet for UDP input (38082)
access_output_udp debug: late packet for UDP input (33064)
access_output_udp debug: late packet for UDP input (28046)
access_output_udp debug: late packet for UDP input (23028)
access_output_udp debug: late packet for UDP input (18010)
access_output_udp debug: late packet for UDP input (12992)
access_output_udp debug: late packet for UDP input (7974)
access_output_udp debug: late packet for UDP input (2956)
main warning: late buffer for mux input (515644)
main warning: late buffer for mux input (515644)
main warning: late buffer for mux input (475644)
main warning: late buffer for mux input (475644)
main warning: late buffer for mux input (435644)
main warning: late buffer for mux input (435644)
main warning: late buffer for mux input (395644)
main warning: late buffer for mux input (395644)
main warning: late buffer for mux input (355644)
main warning: late buffer for mux input (77644)
main warning: late buffer for mux input (77644)
main warning: late buffer for mux input (37644)
main warning: late buffer for mux input (37644)
main debug: removing module "rawvideo"
main debug: removing module "x264"
x264 debug: framecount still in libx264 buffer: 0
access_output_udp debug: packet has been sent too late (275861)
access_output_udp debug: packet has been sent too late (272131)
x264 info: frame I:16 Avg QP:10.82 size: 71992
access_output_udp debug: packet has been sent too late (267401)
x264 info: frame P:962 Avg QP:12.15 size: 25081
access_output_udp debug: packet has been sent too late (262672)
x264 info: frame B:2829 Avg QP:14.74 size: 5870
access_output_udp debug: packet has been sent too late (257942)
x264 info: consecutive B-frames: 0.7% 0.4% 0.6% 98.3%
x264 info: mb I I16..4: 7.8% 58.8% 33.4%
access_output_udp debug: packet has been sent too late (253212)
x264 info: mb P I16..4: 0.2% 1.2% 0.2% P16..4: 34.9% 32.5% 28.3% 0.0% 0.0% skip: 2.8%
access_output_udp debug: packet has been sent too late (248482)
x264 info: mb B I16..4: 0.0% 0.4% 0.0% B16..8: 53.4% 0.0% 0.0% direct: 6.1% skip:40.0% L0:50.1% L1:37.4% BI:12.4%
access_output_udp debug: packet has been sent too late (243753)
x264 info: final ratefactor: 12.87
access_output_udp debug: packet has been sent too late (239023)
x264 info: 8x8 transform intra:74.9% inter:59.9%
access_output_udp debug: packet has been sent too late (235293)
x264 info: coded y,uvDC,uvAC intra: 93.7% 98.4% 97.0% inter: 34.8% 48.8% 37.5%
x264 info: i16 v,h,dc,p: 12% 3% 2% 83%
access_output_udp debug: packet has been sent too late (230563)
x264 info: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 8% 44% 3% 5% 5% 4% 5% 5%
access_output_udp debug: packet has been sent too late (225834)
x264 info: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 17% 11% 5% 6% 7% 9% 6% 8%
access_output_udp debug: packet has been sent too late (221104)
x264 info: i8c dc,h,v,p: 64% 9% 17% 9%
x264 info: Weighted P-Frames: Y:4.0% UV:3.2%
access_output_udp debug: packet has been sent too late (216374)
x264 info: ref P L0: 38.0% 2.6% 43.5% 15.6% 0.3%
access_output_udp debug: packet has been sent too late (211644)
x264 info: ref B L0: 55.8% 35.2% 9.1%
x264 info: ref B L1: 85.8% 14.2%
x264 info: kb/s:2200.55
access_output_udp debug: packet has been sent too late (206915)
access_output_udp debug: packet has been sent too late (202185)
access_output_udp debug: packet has been sent too late (197455)
access_output_udp debug: packet has been sent too late (44064)
access_output_udp debug: packet has been sent too late (39046)
access_output_udp debug: packet has been sent too late (34028)
access_output_udp debug: packet has been sent too late (29010)
access_output_udp debug: packet has been sent too late (23992)
main debug: Filter 13679054 removed from chain
main debug: removing module "swscale"
mux_ts debug: removing input pid=69
mux_ts debug: new PCR PID is 68
mux_ts debug: removing input pid=69
mux_ts debug: new PCR PID is 68
main debug: removing module "packetizer_copy"
main debug: killing decoder fourcc `s16l', 0 PES in FIFO
main debug: removing a sout input (sout_input:043cf3d0)
avcodec debug: Flushing..
avcodec debug: Flushing..
main debug: removing module "araw"
main debug: removing module "avcodec"
main debug: removing module "ugly_resampler"
mux_ts debug: removing input pid=68
mux_ts debug: new PCR PID is 8191
main warning: no more input streams for this mux
mux_ts debug: removing input pid=68
mux_ts debug: new PCR PID is 8191
main warning: no more input streams for this mux
main debug: removing module "dshow"
dshow debug: CaptureFilter::Pause
dshow debug: CaptureFilter::Pause
dshow debug: CaptureFilter::Stop
dshow debug: CapturePin::EndFlush
dshow debug: CaptureFilter::Stop
dshow debug: CapturePin::EndFlush
dshow debug: releasing DirectShow
dshow debug: DeleteDirectShowGraph: Removing filters
dshow debug: DeleteDirectShowGraph: Removing capture filter
dshow debug: CaptureFilter::EnumPins
dshow debug: CapturePin::QueryDirection
dshow debug: CapturePin::ConnectedTo [OK]
dshow debug: CapturePin::Disconnect [OK]
dshow debug: CaptureFilter::SetSyncSource
dshow debug: CaptureFilter::JoinFilterGraph
dshow debug: CaptureFilter::GetState 0
dshow debug: DeleteDirectShowGraph: Removing device filter
dshow debug: DeleteDirectShowGraph: Removing capture filter
dshow debug: CaptureFilter::EnumPins
dshow debug: CapturePin::QueryDirection
dshow debug: CapturePin::ConnectedTo [OK]
dshow debug: CapturePin::Disconnect [OK]
dshow debug: CaptureFilter::SetSyncSource
dshow debug: CaptureFilter::JoinFilterGraph
dshow debug: CaptureFilter::GetState 0
dshow debug: DeleteDirectShowGraph: Removing device filter
main debug: Program doesn't contain anymore ES
main debug: incoming request - stopping current input
main debug: dead input
main debug: destroying useless sout
main debug: destroying chain... (name=transcode)
main debug: removing module "stream_out_transcode"
main debug: destroying chain done
main debug: destroying chain... (name=duplicate)
main debug: removing module "stream_out_duplicate"
stream_out_duplicate debug: closing a duplication
main debug: destroying chain... (name=std)
main debug: removing module "stream_out_standard"
main debug: removing module "mux_ts"
main debug: removing module "access_output_file"
access_output_file debug: file access output closed
main debug: destroying chain done
main debug: destroying chain... (name=std)
main debug: removing module "stream_out_standard"
main debug: removing module "mux_ts"
main debug: removing module "access_output_udp"
main debug: destroying chain done
main debug: destroying chain done
qt4 debug: IM: Deleting the input
Note: I removed thousands of "access_output_udp debug: late packet for UDP input" and "main warning: late buffer for mux input" from the log to save space, since it's like thousands of those messages for under a minute of video stream.
This command line causes the following behaviour:
- Only 1 frame gets shown and stays fixed
- The stream gets transcoded and send to localhost through udp (same if I use rtp)
- I can open that udp source on a second vlc instance.
- The file prueba2.mp4 gets created.
- That file can't be open in anynthing else other than VLC, and in VLC it starts as only audio for about 5 seconds and then video shows up to the party.
- When executing the command twice for the first vlc instance. The file created (due to the "append") ends up with 2 blocks of audio only; one at the beggining and in the middle, where the second part was appended.
- File is pretty much useless since I can't do anything with it other than playing on vlc, tried to fix it with several mpeg tools with no luck.
- If I stop instance number one (the one transcoding and streaming to localhost), the second instance keeps playing in an andless loop the stream received.
Tried lots of variations with the following results:
- If i add anything to the command line that opens the card, video always gets freezed at a frame. If I disable and then re-enable the video track without stopping VLC, frame gets updated to a new one but also stays freezed.
- If I try to dump the file on the second instance that's playing the localhost stream, it also gets screwed the same way.
- If I add "tune=zerolatency" option to the x264 encoder nothing gets to the second instance and processor usage goes high (not 100% though, about 50% or 60%). Then, after I stop and close the first instance, the second one starts displaying screwed frames with green sections and blocks from different frames.
I tried using MPEG2 instead of h264. Used the following command and several others similar ones.
Code: Select all
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -vvv dshow:// :dshow-vdev="Decklink Video Capture" :dshow-adev="Decklink Audio Capture" :dshow-size="1920x1080" :dshow-aspect-ratio=16\:9 :dshow-chroma=UYVY :dshow-fps=25 :no-dshow-config :no-dshow-tuner :live-caching=1000 --sout="#transcode{venc=ffmpeg,vcodec=mp2v,vb=8000,width=1280,height=720,fps=25,acodec=a52,ab=128,channels=2,samplerate=48000} :rtp{caching=100, ttl=128,mux=ts,dst=127.0.0.1,port=1234} --sout-keep"
MPEG 2 doesn't get out of the first instance, and VLC hangs up, doesn't let me do anything other than force quit from task manager.
Everything was tried for several resolutions in the transcode settings.
Most of this behaviour was replicated both in a laptop using a Blackmagic Ultrastudio SDI and on a desktop using a Blackmagic mini recorder. Both machines are big enough to handle the task (i7 with 4 cores, doubled by the HT, 16GB ram, etc.)
Most of the desired behaviour (that would be: being able to open a camera feed, transcode it and stream it and/or save it to disk, both in Mpeg2 and h.264 and using "zerolatency" settings) works perfectly when using HDV camera through a IEEE 1394 interface, and also with webcams.
In this case, it works both from command line and (with some troubleshotting) from C# code using libvlc.
I would need to add SDI/HDMI support cause firewire/1394 is not being used anymore and I know people have succesfully used blackmagic cards with vlc before for several tasks.
I'm kind of stuck with this, so any help is appreciated.
Thanks.