rtmp to rtsp

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
mirswith
Blank Cone
Blank Cone
Posts: 49
Joined: 15 Dec 2011 01:15

rtmp to rtsp

Postby mirswith » 08 Feb 2012 18:57

Hi. I have setup VLC to transcode an rtmp stream for rtsp delivery using the following command:

Code: Select all

vlc rtmp://mydomain/live/demo -I dummy --sout "#transcode{vcodec=h264,vb=2048,fps=15,scale=1,venc=x264{preset=ultrafast,tune=zerolatency,aud,profile=baseline,level=30,keyint=15,bframes=0,ref=1,nocabac},acodec=mp4a,ab=128,channels=2,samplerate=44100,audio-sync}:rtp{sdp=rtsp://:5544/test}" --rtsp-timeout=-1 --no-sout-rtp-sap --no-sout-standard-sap --ttl=1 --sout-keep
Which seems to work however two things happen (btw, im using v2.1.0-git win7 for the server), the first is that the client disconnects at varying times, sometimes within a few seconds others a few minutes (using VLC v1.1.12 osx for the client).

Here is the server output:

Code: Select all

[0x553e08] main libvlc: one instance mode ENABLED [0x4c7b60] dummy interface: VLC media player - 2.1.0-git Rincewind [0x4c7b60] dummy interface: Copyright ▒ 1996-2012 the VideoLAN team [0x4c7b60] dummy interface: Warning: if you cannot access the GUI anymore, open a command-line window, go to the directory where you installed VLC and run "vlc -I qt" [0x4c7b60] dummy interface: using the dummy interface module... Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later. Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later. [flv @ 0x4dacc0] Estimating duration from bitrate, this may be inaccurate [0x6450c30] x264 encoder: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT [0x6450c30] x264 encoder: profile Constrained Baseline, level 3.0 [0x6450c30] x264 encoder: final ratefactor: 30.86 [0x5062c0] avcodec generic: obtained IDirect3DDeviceManager9 [0x5062c0] avcodec generic: DXVA2CreateVideoService Success! [0x5062c0] avcodec generic: Using DXVA2 (NVIDIA GeForce GTX 460, vendor 4318(NVIDIA), device 3618, revision 161) for hardware decoding. [h264 @ 0x53993a0] Cannot parallelize deblocking type 1, decoding such frames in sequential order [0x6450c30] x264 encoder: using SAR=1/1 [0x6450c30] x264 encoder: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT [0x6450c30] x264 encoder: profile Constrained Baseline, level 3.0 [0x5022a8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 300 ms) [0x5022a8] main input error: ES_OUT_RESET_PCR called [0x5022a8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 500 ms) [0x5022a8] main input error: ES_OUT_RESET_PCR called [0x5022a8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 1765 ms) [0x5022a8] main input error: ES_OUT_RESET_PCR called [0x5022a8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 1794 ms) [0x5022a8] main input error: ES_OUT_RESET_PCR called [0x5022a8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 2417 ms) [0x5022a8] main input error: ES_OUT_RESET_PCR called [0x5022a8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 2826 ms) [0x5022a8] main input error: ES_OUT_RESET_PCR called
And here is the client output:

Code: Select all

main debug: processing request item rtsp://192.168.88.2:5544/test node Playlist skip 0 main debug: resyncing on rtsp://192.168.88.2:5544/test main debug: rtsp://192.168.88.2:5544/test is at 0 main debug: starting new item main debug: creating new input thread main debug: Creating an input for 'rtsp://192.168.88.2:5544/test' main debug: thread (input) created at priority 22 (../../src/input/input.c:220) main debug: thread started main debug: using timeshift granularity of 50 MiB main debug: using timeshift path '/tmp' main debug: `rtsp://192.168.88.2:5544/test' gives access `rtsp' demux `' path `192.168.88.2:5544/test' main debug: creating demux: access='rtsp' demux='' path='192.168.88.2:5544/test' main debug: looking for access_demux module: 1 candidate macosx debug: input has changed, refreshing interface live555 debug: RTP subsession 'video/H264' main debug: selecting program id=0 live555 debug: setup start: 0.000000 stop:0.000000 live555 debug: We have a timeout of 60 seconds live555 debug: spawned timeout thread live555 debug: play start: 13.096374 stop:0.000000 main debug: using access_demux module "live555" main debug: TIMER module_need() : 487.166 ms - Total 487.166 ms / 1 intvls (Avg 487.166 ms) main debug: looking for decoder module: 32 candidates avcodec debug: libavcodec already initialized avcodec debug: trying to use direct rendering avcodec debug: ffmpeg codec (H264 - MPEG-4 AVC (part 10)) started main debug: using decoder module "avcodec" main debug: TIMER module_need() : 0.989 ms - Total 0.989 ms / 1 intvls (Avg 0.989 ms) main debug: looking for packetizer module: 21 candidates packetizer_h264 debug: found NAL_SPS (sps_id=0) packetizer_h264 debug: found NAL_PPS (pps_id=0 sps_id=0) main debug: using packetizer module "packetizer_h264" main debug: TIMER module_need() : 0.235 ms - Total 0.235 ms / 1 intvls (Avg 0.235 ms) main debug: thread (decoder) created at priority 0 (../../src/input/decoder.c:301) main debug: thread started main debug: looking for meta reader module: 2 candidates lua debug: Trying Lua scripts in /Users/bsiroshton/Library/Application Support/org.videolan.vlc/lua/meta/reader lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/reader main debug: no meta reader module matching "any" could be loaded main debug: TIMER module_need() : 0.963 ms - Total 0.963 ms / 1 intvls (Avg 0.963 ms) main debug: `rtsp://192.168.88.2:5544/test' successfully opened main debug: Buffering 0% ... main debug: Buffering 99% main debug: Stream buffering done (466 ms in 136 ms) main debug: Decoder buffering done in 0 ms live555 debug: lost 993 bytes live555 debug: increasing buffer size to 131072 main debug: no usable vout present, spawning one main debug: looking for text renderer module: 3 candidates main debug: using text renderer module "quartztext" main debug: TIMER module_need() : 0.207 ms - Total 0.207 ms / 1 intvls (Avg 0.207 ms) main debug: looking for video filter2 module: 18 candidates swscale debug: 32x32 chroma: YUVA -> 16x16 chroma: YUVA with scaling using Bicubic (good quality) main debug: using video filter2 module "swscale" main debug: TIMER module_need() : 0.326 ms - Total 0.326 ms / 1 intvls (Avg 0.326 ms) main debug: looking for video filter2 module: 18 candidates yuvp debug: YUVP to YUVA converter main debug: using video filter2 module "yuvp" main debug: TIMER module_need() : 0.151 ms - Total 0.151 ms / 1 intvls (Avg 0.151 ms) main debug: window size: 1920x1080 main debug: Deinterlacing available main debug: deinterlace 0, mode blend, is_needed 0 main debug: looking for video output module: 2 candidates main debug: looking for opengl provider module: 2 candidates macosx debug: display is Quartz Extreme accelerated main debug: using opengl provider module "macosx" main debug: TIMER module_need() : 54.565 ms - Total 54.565 ms / 1 intvls (Avg 54.565 ms) main debug: using video output module "opengl" main debug: TIMER module_need() : 54.846 ms - Total 54.846 ms / 1 intvls (Avg 54.846 ms) main debug: got 1 direct buffer(s) main debug: pic render sz 1920x1080, of (0,0), vsz 1920x1080, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0 main debug: pic in sz 1920x1080, of (0,0), vsz 1920x1080, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0 main debug: pic out sz 1920x1080, of (0,0), vsz 1920x1080, 4cc UYVY, sar 1:1, msk r0x0 g0x0 b0x0 main debug: looking for video filter2 module: 18 candidates main debug: using video filter2 module "i420_yuy2_sse2" main debug: TIMER module_need() : 0.247 ms - Total 0.247 ms / 1 intvls (Avg 0.247 ms) main debug: indirect render, mapping render pictures 0-24 to system pictures 1-25 avcodec debug: using direct rendering main debug: End of video preroll main debug: looking for video blending module: 1 candidate blend debug: chroma: YUVA -> UYVY main debug: using video blending module "blend" main debug: TIMER module_need() : 0.345 ms - Total 0.345 ms / 1 intvls (Avg 0.345 ms) main debug: Post-processing available main warning: vlc_object_find_name(postproc) is not safe! live555 debug: tk->rtpSource->hasBeenSynchronizedUsingRTCP() main debug: ES_OUT_RESET_PCR called main debug: Buffering 0% ... main debug: Buffering 16% main debug: End of video preroll main debug: Received first picture main debug: Buffering 33% ... main debug: Buffering 99% main debug: Stream buffering done (466 ms in 560 ms) main debug: Decoder buffering done in 17 ms main warning: late picture skipped (115143 > -1479) main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 400 ms) main debug: ES_OUT_RESET_PCR called main debug: Buffering 0% ... main debug: Buffering 0% live555 warning: no data received in 10s, eof ? main debug: EOF reached main debug: Stream buffering done (0 ms in 10142 ms) main debug: Decoder buffering done in 0 ms main debug: finished input avcodec debug: ffmpeg codec (H264 - MPEG-4 AVC (part 10)) stopped main debug: removing module "avcodec" main debug: killing decoder fourcc `h264', 0 PES in FIFO main debug: [0] 4 0 main debug: [1] 4 0 main debug: [2] 4 0 main debug: [3] 4 0 main debug: [4] 4 0 main debug: [5] 4 0 main debug: [6] 4 0 main debug: [7] 4 0 main debug: [8] 4 0 main debug: [9] 2 0 main debug: [10] 0 0 main debug: [11] 0 0 main debug: [12] 0 0 main debug: [13] 0 0 main debug: [14] 0 0 main debug: [15] 0 0 main debug: [16] 0 0 main debug: [17] 0 0 main debug: [18] 0 0 main debug: [19] 0 0 main debug: [20] 0 0 main debug: [21] 0 0 main debug: [22] 0 0 main debug: [23] 0 0 macosx debug: input has stopped, refreshing interface main debug: [24] 4 0 main debug: saving a free vout main debug: removing module "packetizer_h264" main debug: removing module "live555" main debug: Program doesn't contain anymore ES main debug: thread ended main debug: dead input main debug: changing item without a request (current 0/1) main debug: nothing to play main debug: destroying useless vout main debug: removing module "i420_yuy2_sse2" main debug: removing module "macosx" main debug: removing module "opengl" main debug: removing module "blend" main debug: removing module "quartztext" main debug: removing module "yuvp" main debug: removing module "swscale"
The second issue is that on occasion (quite frequently) the server will fail with an exception

Code: Select all

x264 [error]: malloc of size 4966163 failed [0x63f2e60] x264 encoder error: cannot open x264 encoder unhandled vlc exception
Any Ideas? Thanks!

mirswith
Blank Cone
Blank Cone
Posts: 49
Joined: 15 Dec 2011 01:15

Re: rtmp to rtsp

Postby mirswith » 08 Feb 2012 19:35

-- Part 2 --

I am using Flash Media Encoder and realized that I do not even need to do the transcode since my client (Android) can decode the same codecs being spit out of FME, which means I simply need to convert the RTMP stream to RTSP. I modified my command line to this:

Code: Select all

vlc rtmp://mydomain/live/demo --sout "#rtp{sdp=rtsp://:5544/test}" --rtsp-timeout=-1 --no-sout-rtp-sap --no-sout-standard-sap --ttl=1 --sout-keep
I am still getting the disconnects which seem to happen much later, a few minutes later. I have seen various server reactions, the first is this:

Code: Select all

[0x713a18] main libvlc: one instance mode ENABLED [0x713a18] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later. Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later. [flv @ 0x6c28e40] Estimating duration from bitrate, this may be inaccurate [0x2edeec8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 300 ms) [0x2edeec8] main input error: ES_OUT_RESET_PCR called [0x2edeec8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 462 ms) [0x2edeec8] main input error: ES_OUT_RESET_PCR called [0x2edeec8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 836 ms) [0x2edeec8] main input error: ES_OUT_RESET_PCR called [0x2edeec8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 875 ms) [0x2edeec8] main input error: ES_OUT_RESET_PCR called [0x2edeec8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 895 ms) [0x2edeec8] main input error: ES_OUT_RESET_PCR called [0x2edeec8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 992 ms) [0x2edeec8] main input error: ES_OUT_RESET_PCR called [0x2edeec8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 1409 ms) [0x2edeec8] main input error: ES_OUT_RESET_PCR called [0x2edeec8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 2880 ms) [0x2edeec8] main input error: ES_OUT_RESET_PCR called [flv @ 0x6c28e40] Unsupported video codec (0) Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later. Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later. ...
Where the last line keeps printing indefinitely.

Another is this:

Code: Select all

[0x853978] main libvlc: one instance mode ENABLED [0x853978] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later. Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later. [flv @ 0x312d220] Estimating duration from bitrate, this may be inaccurate [0x30103e0] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 300 ms) [0x30103e0] main input error: ES_OUT_RESET_PCR called [0x30103e0] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 610 ms) [0x30103e0] main input error: ES_OUT_RESET_PCR called [0x30103e0] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 681 ms) [0x30103e0] main input error: ES_OUT_RESET_PCR called [0x30103e0] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 768 ms) [0x30103e0] main input error: ES_OUT_RESET_PCR called [0x30103e0] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 849 ms) [0x30103e0] main input error: ES_OUT_RESET_PCR called
Where the client was disconnected and the server just sits on that last line.

And finally another like this:

Code: Select all

... [0x2ec0ec8] main input error: ES_OUT_RESET_PCR called [0x2ec0ec8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 880 ms) [0x2ec0ec8] main input error: ES_OUT_RESET_PCR called [rtmp @ 0x2eb0e80] Chunk size change packet is not 4 bytes long (0) ... [rtmp @ 0x2eb0e80] Chunk size change packet is not 4 bytes long (0) Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later. Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later. [h264 @ 0x2feb3c0] get_buffer() failed (-1 0 0) [h264 @ 0x2feb3c0] decode_slice_header error [h264 @ 0x2feb3c0] no frame! [h264 @ 0x2feb3c0] get_buffer() failed (-1 0 0) [h264 @ 0x2feb3c0] decode_slice_header error [h264 @ 0x2feb3c0] no frame!
Where the last 3 lines get repeated over and over.

Thanks again.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: Google Adsense [Bot] and 23 guests