RTMP stream always opens audio, inconsistently displays video

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
schnugee
New Cone
New Cone
Posts: 4
Joined: 16 Feb 2020 01:16

RTMP stream always opens audio, inconsistently displays video

Postby schnugee » 16 Feb 2020 02:12

I'm a long time fan of VLC player, but a new poster to this forum, please bear with any noob mistakes. I'm using OBS to create some RTMP streams to an NGINX server, then opening the streams for playback on multiple PCs and Macs in VLC. I have so far had 100% success rate in getting the streams to open / playback, and I have been able to hear clear audio in every attempt. I'm having mixed success with getting the video in the same streams to display. Some times stopping, waiting a few seconds, then re-starting playback results in the video displaying as desired. Other times, I'll stop and restart multiple times, and only get audio playback. I've been able to detect no pattern to success with getting video playback, or not. I ran a test on 10 PCs this afternoon: 6 opened the stream audio & video on the first attempt. 4 played audio with no video when launched. 2 displayed video after the first stop & re-start, 1 took 3 re-starts, 1 took 5. I also opened the same stream on a Mac with a fresh VLC player install, no video until the 4th stop & re-start.

I believe this question was asked once before, but the thread "died" after a helpful reply asked for debug info. https://forum.videolan.org/viewtopic.php?f=2&t=133062&p=441828&hilit=rtmp+stream+audio+not+video#p441828

I'd like to find the answer to this bug, if @Lotesdelere or another helpful contributor can offer any insight, or suggest a place to start digging.

Thank you for reading, and God bless!

#thweiss
Cone that earned his stripes
Cone that earned his stripes
Posts: 136
Joined: 07 Nov 2017 07:13
Location: Germany

Re: RTMP stream always opens audio, inconsistently displays video

Postby #thweiss » 17 Feb 2020 15:58

It is always good to have some Examples, so I will add several *.rtmp-Streams for testing with the VLC-Player.

If you like, you can save the Stream-Examples as *.m3u Playlist ("RTMP-Playlist.m3u") and open it in the VLC-Player.

Code: Select all

#EXTM3U #EXTINF:-1,Nac TV rtmp://pivotalelements.com:1935/live/NACTV #EXTINF:-1,polar rtmp://stream.polar.cz/polar/polarlive-1 #EXTINF:-1,Praha TV rtmp://stream.polar.cz/prahatv/prahatvlive-1 #EXTINF:-1,Grand Lille rtmp://str81.creacast.com/grandlilletv/high #EXTINF:-1,Normandie rtmp://live.lachainenormande.fr/live/lcn/livestream #EXTINF:-1,ATV rtmp://nodes.stream.atv.hu/atvliveedge/_definst_/atvstream_2_aac #EXTINF:-1,Fix TV rtmp://video.fixhd.tv/fix/hd.stream #EXTINF:-1,Hatoscsatorna rtmp://lpmedia.hu:1935/Hatoscsatorna/livestream #EXTINF:-1,Kölcsey TV rtmp://193.138.125.14:1935/live/kolcseytv.stream #EXTINF:-1,ZFM 1 rtmp://kippingmultimediaal.nl:1935/live/ZFM1 #EXTINF:-1,Stella rtmp://live-tvk.tvkstella.pl/flvplayback/StellaLive

On my PC I can play all listed Streams successfull with the VLC-Player 3.0.8 (64-Bit) under Windows 10.

schnugee
New Cone
New Cone
Posts: 4
Joined: 16 Feb 2020 01:16

Re: RTMP stream always opens audio, inconsistently displays video

Postby schnugee » 17 Feb 2020 17:16

#thweiss thank you for the reply, and the links to test streams. I'm running VLC 3.0.8 on Windows 10 on my primary test PC. I was able to open links / streams 1-3, 5-8, 10 & 11 and get audio and video playback. I encountered some compression artifacts / loss of data, but nothing I wouldn't expect from a source on another continent. Player failed to find the stream for link / stream 4, this could be due to U.S. IPs being denied connection to the stream. Link / stream 9 attempted to connect for more than a minute, but never received audio or video, I suspect this is due to bandwidth between the source and my destination.

Based on these test samples, it appears that the player will render audio and video from all streams it can connect to, except for the environment I am attempting to put into production. The issue I'm trying to resolve may not be due to VLC player, but due to an incorrect configuration at my OBS encoder source, or my NGINX distribution server.

I'll continue to troubleshoot and report any new findings.

Thank you and God bless!

schnugee
New Cone
New Cone
Posts: 4
Joined: 16 Feb 2020 01:16

Re: RTMP stream always opens audio, inconsistently displays video

Postby schnugee » 17 Feb 2020 21:05

It took me a bit of trial, error and searching, but I learned how to enable verbose logging through: Tools\Messages change Verbosity to 2 (debug) , then leaving the messaging window open when attempting to connect to the stream.

I saved the files after a few attempts to launch the stream resulted in audio playback only, then finally got audio & video playback captured. I then compared using winmerge. The first significant change was at line 95 in the success log :

Code: Select all

avcodec debug: adding es: video codec = h264 (27)
This line is missing in the logs when I got audio playback only.
Next significant changes start at line 105:

Code: Select all

main debug: looking for video decoder module matching "any": 19 candidates avcodec debug: using ffmpeg Lavc58.6.103 avcodec debug: CPU flags: 0x000fd3db avcodec debug: allowing 5 thread(s) for decoding avcodec debug: codec (h264) started avcodec debug: using frame thread mode with 5 threads main debug: using video decoder module "avcodec"
These lines missing from audio only logs.
Some minor variance in buffering progress reports, next significant change at line 185:

Code: Select all

main error: buffer deadlock prevented
This line is missing from audio only logs.
Next significant changes are lines 189 - 313 (truncated to allow posting in message):

Code: Select all

avcodec debug: available hardware decoder output format 119 (cuda) avcodec debug: available hardware decoder output format 53 (dxva2_vld) avcodec debug: available hardware decoder output format 118 (d3d11va_vld) avcodec debug: available hardware decoder output format 174 (d3d11) avcodec debug: available software decoder output format 0 (yuv420p) avcodec debug: trying format d3d11va_vld main debug: looking for text renderer module matching "any": 3 candidates freetype debug: Using DWrite backend freetype debug: DWrite_GetFamily(): family name: Arial freetype debug: DWrite_ParseFamily(): using font at index 0 with weight 400 for bold: 0, italic: 0 freetype debug: DWrite_ParseFamily(): using font at index 1 with weight 700 for bold: 1, italic: 0 freetype debug: DWrite_ParseFamily(): using font at index 2 with weight 400 for bold: 0, italic: 1 freetype debug: DWrite_ParseFamily(): using font at index 3 with weight 700 for bold: 1, italic: 1 main debug: using text renderer module "freetype" main debug: looking for video converter module matching "any": 24 candidates swscale debug: 32x32 (32x32) chroma: YUVA -> 16x16 (16x16) chroma: RGBA with scaling using Bicubic (good quality) main debug: using video converter module "swscale" main debug: looking for video converter module matching "any": 24 candidates yuvp debug: YUVP to YUVA converter main debug: using video converter module "yuvp" main debug: Deinterlacing available main debug: deinterlace -1, mode auto, is_needed 0 main debug: looking for vout window module matching "qt,any": 3 candidates qt debug: requesting video window... main debug: resized to 587x509 main debug: resized to 1280x720 main debug: using vout window module "qt" main debug: looking for inhibit module matching "any": 1 candidates main debug: using inhibit module "inhibit" main debug: Opening vout display wrapper main debug: looking for vout display module matching "any": 12 candidates direct3d11 debug: creating Vout EventThread direct3d11 debug: Win32VoutCreateWindow main debug: VoutDisplayEvent 'resize' 1280x720 qt debug: Logical video size: 1280x720 main debug: resized to 1280x720 main debug: VoutDisplayEvent 'resize' 1280x720 direct3d11 debug: inclinometer not found. (hr=0x80070490) direct3d11 debug: created video sub-window direct3d11 debug: Vout EventThread running direct3d11 debug: Created the D3D11 device type 1 level b100. direct3d11 warning: failed to get the 0 MatchingDeviceId (2) direct3d11 debug: Intel WDDM driver 21.20.16.4550 direct3d11 debug: supports colorspace RGB Rec.709 gamma:22 range:FULL direct3d11 debug: supports colorspace RGB Rec.709 gamma:22 range:STUDIO direct3d11 debug: supports colorspace RGB Rec.2020 gamma:22 range:STUDIO direct3d11 debug: supports colorspace RGB Rec.2020 gamma:22 range:FULL direct3d11 debug: supports colorspace RGB Rec.2020 gamma:2084 range:FULL direct3d11 debug: supports colorspace RGB Rec.2020 gamma:2084 range:STUDIO direct3d11 debug: Output max luminance: 270.0, colorspace RGB Rec.709 gamma:22 range:FULL, bits per pixel 8 direct3d11 debug: using colorspace RGB Rec.709 gamma:22 range:FULL direct3d11 debug: Using pixel format VA_NV12 for chroma DX11 main debug: VoutDisplayEvent 'resize' 1296x759 direct3d11 debug: Direct3D11 resources created direct3d11 debug: Direct3D11 device adapter successfully initialized direct3d11 debug: Direct3D11 Open Succeeded main debug: using vout display module "direct3d11" direct3d11 debug: D3D11 pool succeed with 38 surfaces (1280x768) context 0x0000015fba631688 main debug: original format sz 1280x720, of (0,0), vsz 1280x720, 4cc DX11, sar 1:1, msk r0x0 g0x0 b0x0 main debug: removing module "freetype"
There are a number of additional differences that may be significant, but occur after playback of the stream was stopped, so I'm guessing they may not be of much use. I generated a difference report in HTML, but not sure how to attach *.html files here to the forum.

My guess is that VLC is not recognizing the stream as supplying video, so it doesn't start applying the video codec to the data to render the video stream?

Not sure if this will help arrive at a solution, but thought it would be good to add to the thread.

Thank you for reading and God bless!

schnugee
New Cone
New Cone
Posts: 4
Joined: 16 Feb 2020 01:16

Re: RTMP stream always opens audio, inconsistently displays video

Postby schnugee » 14 Apr 2020 19:20

I think I may have stumbled upon the answer to what was causing the issue. Since I am pretty new to RTMP, I decided to research the overall protocol to see if additional familiarity might provide a clue. I found this resource very helpful: https://www.youtube.com/watch?v=AoRepm5ks80

The hypothesis I was forming was that my issue might be related to the Chunk Size setting on my NGINX server. I started searching for best practices for setting the chunk size value, recognizing that there was a trade off with stream data efficiency vs. overhead. I came across a forum post from years ago regarding the need to manually set the Key Frame rate in OBS to 2 seconds and not auto, for compatibility with Twitch. It made me wonder whether the frequency of key frames from my content might result in a failure of VLC to recognize the need to apply the proper video codec when launching the stream, and the intermittent results I was seeing with audio only playback.

I tested the new Key Frame setting hypothesis by navigating to the Key Frame setting: OBS\Settings\Output\Streaming\Advanced\Keyframe interval
-Was set to =0 (automatic)
-Now set to =2 (seconds)

I then started the stream from OBS, and connected to the output stream of my NGINX instance from multiple endpoints. Where I was experiencing a roughly 40% rate of getting audio only playback with the old setting, I now got 100% video and audio playback when connecting the the stream from 9 endpoints. I stopped playback, waited about 10 seconds, then re-started, an again achieved 100% video playback. I rebooted each endpoint, and again launched VLC Player, and had 100% video success when connecting to the stream.

I'll retest with a greater number of endpoints when they are available, and provide an update.

Thank you for reading & God bless!


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 12 guests