Page 1 of 1

Problems with playing back HD H.264 Live Streaming using VLC

Posted: 23 Sep 2013 09:19
by ERCer
Hi experts,

Currently I'm using VLC to playback H.264 live streaming from an IPNC(IP network Camera).

- With H.264 720p (1280x720), the I frames' size is about 100,000 Kbytes then the first frame played back broken as shown below and the buffer (loading) bar appears twice at the 1st second and 2nd or 3rd second.
- Even when I saved the H.264 stream to the SD card right on the IPNC (before it is streamed) and stream it using Live555 and at the client side I use VLC to play back, I still face those problems.
- With low resolution H.264 (I frames's size is under 65 Kbytes), then I don't get such problems.

Plz help me.
I appreciate your help.

Image

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 27 Sep 2013 18:43
by Jean-Baptiste Kempf
increase network-caching option.

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 08 Oct 2013 17:21
by ERCer
Thank you for your response.
I'm sorry for late reply because I was working on other project. Now I'm back on my problem.
I tried to increase caching from the Input/Codec -> advanced :file caching, network caching, live capture caching. But it does not solve the problem. Once again, my problem is caused when the I frames' size is too big and it just happens for the first frame ( at the 1st second playing back), after that it's playing ok.

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 10 Oct 2013 04:42
by ERCer
Any ideas?

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 10 Oct 2013 17:50
by Jean-Baptiste Kempf
Look at the logs. Are you sure the data is arriving to VLC in time?

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 11 Oct 2013 11:22
by ERCer
Thanks Jeans,

Look at the logs I got this:

freetype error: Breaking unbreakable line
main error: ES_OUT_RESET_PCR called


Would you plz tell me what I have to do to deal with them?

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 15 Oct 2013 12:42
by Jean-Baptiste Kempf
Please set verbosity to 2.

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 31 Oct 2013 03:39
by ERCer
Sorry, I was on Vacation for 2 weeks. Now i'm back to work.
BTW by setting verbosity to 2, I got this:

main debug: adding item `rtsp: //192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264' ( rtsp://192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264 )
qt4 debug: Adding a new MRL to recent ones: rtsp://192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264
main debug: rebuilding array of current - root Playlist
main debug: rebuild done - 1 items, index -1
main debug: processing request item: rtsp: //192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264, node: null, skip: 0
main debug: resyncing on rtsp://192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264
main debug: no fetch required for (null) (art currently (null))
main debug: rtsp: //192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264 is at 0
main debug: starting playback of the new playlist item
main debug: resyncing on rtsp: //192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264
main debug: rtsp: //192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264 is at 0
main debug: creating new input thread
main debug: Creating an input for 'rtsp://192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264'
main debug: using timeshift granularity of 50 MiB, in path 'C:\Users\PHUOCP~1\AppData\Local\Temp'
main debug: `rtsp://192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264' gives access `rtsp' demux `' path `192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264'
main debug: creating demux: access='rtsp' demux='' location='192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264' file='\\192.168.0.8:8557\PSIA\Streaming\channels\2?videoCodecType=H.264'
main debug: looking for access_demux module: 1 candidate
live555 debug: version 2012.12.18
qt4 debug: IM: Setting an input
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: 0.000000 stop:0.000000
main debug: using access_demux module "live555"
main debug: TIMER module_need() : 122.098 ms - Total 122.098 ms / 1 intvls (Avg 122.098 ms)
main debug: looking for decoder module: 32 candidates
avcodec debug: libavcodec initialized (interface 0x362901)
avcodec debug: trying to use direct rendering
avcodec debug: allowing 4 thread(s) for decoding
avcodec debug: ffmpeg codec (H264 - MPEG-4 AVC (part 10)) started
avcodec debug: using frame thread mode with 4 threads
main debug: using decoder module "avcodec"
main debug: TIMER module_need() : 5.671 ms - Total 5.671 ms / 1 intvls (Avg 5.671 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() : 1.400 ms - Total 1.400 ms / 1 intvls (Avg 1.400 ms)
main debug: looking for meta reader module: 2 candidates
lua debug: Trying Lua scripts in C:\Users\PhuocPham\AppData\Roaming\vlc\lua\meta\reader
lua debug: Trying Lua scripts in C:\Program Files (x86)\VideoLAN\VLC\lua\meta\reader
lua debug: Trying Lua playlist script C:\Program Files (x86)\VideoLAN\VLC\lua\meta\reader\filename.luac
main debug: no meta reader module matching "any" could be loaded
main debug: TIMER module_need() : 0.634 ms - Total 0.634 ms / 1 intvls (Avg 0.634 ms)
main debug: `rtsp://192.168.0.8:8557/PSIA/Streaming/channels/2?videoCodecType=H.264' successfully opened
main debug: Buffering 0%
main debug: Buffering 0%
main debug: Buffering 0%
main debug: Buffering 0%
main debug: Buffering 0%
main debug: Buffering 6%
main debug: Buffering 7%
main debug: looking for text renderer module: 2 candidates
freetype debug: Using Arial as font from file C:\Windows\Fonts\arial.ttf
freetype debug: using fontsize: 2
main debug: using text renderer module "freetype"
main debug: TIMER module_need() : 17.604 ms - Total 17.604 ms / 1 intvls (Avg 17.604 ms)
main debug: looking for video filter2 module: 18 candidates
swscale debug: 32x32 chroma: YUVA -> 16x16 chroma: RGBA with scaling using Bicubic (good quality)
main debug: using video filter2 module "swscale"
main debug: TIMER module_need() : 0.671 ms - Total 0.671 ms / 1 intvls (Avg 0.671 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() : 1.428 ms - Total 1.428 ms / 1 intvls (Avg 1.428 ms)
main debug: Deinterlacing available
main debug: deinterlace 0, mode blend, is_needed 0
main debug: Opening vout display wrapper
main debug: looking for vout display module: 6 candidates
direct3d debug: creating Vout EventThread
direct3d debug: DirectXCreateWindow
main debug: looking for vout window hwnd module: 2 candidates
qt4 debug: requesting video...
qt4 debug: Video was requested 0, 0
main debug: using vout window hwnd module "qt4"
main debug: TIMER module_need() : 10.372 ms - Total 10.372 ms / 1 intvls (Avg 10.372 ms)
direct3d debug: created video sub-window
direct3d debug: Vout EventThread running
direct3d debug: disabling screen saver
direct3d debug: Direct3d Device: NVIDIA GeForce GTX 550 Ti 4318 4676 161
main debug: Buffering 10%
main debug: VoutDisplayEvent 'resize' 1296x758 window
direct3d warning: trying surface pixel format: YV12
direct3d debug: selected surface pixel format is YV12
direct3d debug: Using D3DTEXF_LINEAR for minification
direct3d debug: Using D3DTEXF_LINEAR for magnification
direct3d debug: Direct3D scene created successfully
direct3d debug: Direct3D device adapter successfully initialized
main debug: using vout display module "direct3d"
main debug: TIMER module_need() : 35.524 ms - Total 35.524 ms / 1 intvls (Avg 35.524 ms)
main debug: original format sz 1280x720, of (0,0), vsz 1280x720, 4cc J420, sar 1:1, msk r0x0 g0x0 b0x0
main debug: removing module "freetype"
main debug: VoutDisplayEvent 'resize' 1280x720 window
main debug: looking for text renderer module: 2 candidates
freetype debug: Using Arial as font from file C:\Windows\Fonts\arial.ttf
freetype debug: using fontsize: 2
main debug: using text renderer module "freetype"
main debug: TIMER module_need() : 0.517 ms - Total 0.517 ms / 1 intvls (Avg 0.517 ms)
avcodec debug: using direct rendering
main debug: Buffering 15%
main debug: Buffering 17%
main debug: End of video preroll
main debug: Received first picture
freetype error: Breaking unbreakable line
direct3d debug: Created 1276x99 texture for OSD
main debug: Post-processing available
main debug: Buffering 20%
main debug: Buffering 25%
main debug: Buffering 27%
main debug: Buffering 30%
main debug: Buffering 35%
main debug: Buffering 37%
main debug: Buffering 40%
main debug: Buffering 45%
main debug: Buffering 47%
main debug: Buffering 50%
main debug: Buffering 55%
main debug: Buffering 57%
main debug: Buffering 60%
main debug: Buffering 65%
main debug: Buffering 67%
main debug: Buffering 70%
main debug: Buffering 74%
main debug: Buffering 77%
main debug: Buffering 80%
main debug: Buffering 84%
main debug: Buffering 87%
main debug: Buffering 90%
main debug: Buffering 94%
main debug: Buffering 97%
main debug: Stream buffering done (1010 ms in 1000 ms)
main debug: Decoder buffering done in 0 ms
main debug: picture might be displayed late (missing 0 ms)
live555 debug: tk->rtpSource->hasBeenSynchronizedUsingRTCP()
main error: ES_OUT_RESET_PCR called
main warning: early picture skipped
main debug: Buffering 0%
main debug: Buffering 3%
main debug: Buffering 6%
main debug: Buffering 10%
main debug: Buffering 13%
main debug: Buffering 16%
main debug: End of video preroll
main debug: Received first picture
main debug: Buffering 20%
main debug: Buffering 23%
main debug: Buffering 26%
main debug: Buffering 30%
main debug: Buffering 33%
main debug: Buffering 33%
main debug: Buffering 33%
main debug: Buffering 37%
main debug: Buffering 40%
main debug: Buffering 42%
main debug: Buffering 46%
main debug: Buffering 50%
main debug: Buffering 53%
main debug: Buffering 56%
main debug: Buffering 60%
main debug: Buffering 63%
main debug: Buffering 66%
main debug: Buffering 70%
main debug: Buffering 73%
main debug: Buffering 76%
main debug: auto hiding mouse cursor
main debug: Buffering 80%
main debug: Buffering 83%
main debug: Buffering 87%
main debug: Buffering 90%
main debug: Buffering 93%
main debug: Buffering 97%
main debug: Stream buffering done (1002 ms in 998 ms)
main debug: Decoder buffering done in 0 ms
main debug: picture might be displayed late (missing 12 ms)
main debug: auto hiding mouse cursor
main debug: auto hiding mouse cursor
main debug: auto hiding mouse cursor

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 04 Nov 2013 06:24
by ERCer
any ideas ? do u need a video sample that causes the problem?

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 07 Nov 2013 03:02
by ERCer
Hello Jean-Baptiste Kempf, are you there?

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 07 Nov 2013 10:45
by ERCer
Hello

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 19 Nov 2013 00:17
by Jean-Baptiste Kempf
Increase input caching.

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 19 Nov 2013 03:01
by ERCer
increase these things? especially network caching?
If so, I tried my times before, but that did not solve mine.


Image

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 09 Dec 2013 08:20
by ERCer
Any other ideas? plz.

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 10 Dec 2013 23:36
by Jean-Baptiste Kempf
Sorry, no idea.

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 13 Dec 2013 10:40
by ERCer
Hi JB,

Someone explained my problem likes this:
Your problem is that your stream's I-frames are too large. VLC uses an initial buffer size of 100,000 bytes when receiving data. If a data frame (in this case, your stream's first I-frame) is larger than this, then the remaining data will be truncated (i.e., lost). VLC recovers from this by doubling the size of the buffer for receiving future frames, but it cannot recover the data that was lost from the first I-frame.
Is that right?

BTW, I read the VLC source code then I find out that they have a module call 'access->mms->mmstu.h' which is used to initially retrieve data from the server has a buffer of 100000 bytes. I increase that buffer to have enough room for incoming I-frames. But it doesn't help me out.
Do you have any ideas?

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 13 Dec 2013 12:29
by Jean-Baptiste Kempf
As you are using RTSP, modifying MMS will not do anything...

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 13 Dec 2013 13:19
by ERCer
Thank you for your response JB,

Could you plz show me where and which module I can increase the initial buffer in case it receives data via RTSP?

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 14 Dec 2013 18:07
by Jean-Baptiste Kempf
live555

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 16 Dec 2013 14:38
by ERCer
Thanks JB,

Can you explain to me why VLC does not have an enough buffer in the first place? Because after losing some data it does increase the buffer by double. I found in the modules/demux/live555 that
k->i_buffer = 65536; and then when it loses data it increases the buffer:

if( i_truncated_bytes > 0 )
{
if( tk->i_buffer < 2000000 )
{
void *p_tmp;
msg_Dbg( p_demux, "lost %d bytes", i_truncated_bytes );
msg_Dbg( p_demux, "increasing buffer size to %d", tk->i_buffer * 2 );
p_tmp = realloc( tk->p_buffer, tk->i_buffer * 2 );
if( p_tmp == NULL )
{
msg_Warn( p_demux, "realloc failed" );
}
else
{
tk->p_buffer = (uint8_t*)p_tmp;
tk->i_buffer *= 2;
}
}

if( tk->b_discard_trunc )
{
p_sys->event_data = 0xff;
tk->waiting = 0;
return;
}
}

Here is the debug message from VLC player on windows.

main debug: Buffering 0%
main debug: Buffering 0%
live555 debug: lost 10607 bytes
live555 debug: increasing buffer size to 200000
main debug: Buffering 0%
main debug: Buffering 4%

Re: Problems with playing back HD H.264 Live Streaming using

Posted: 16 Dec 2013 16:51
by Jean-Baptiste Kempf
To be honest, I don't know.