linuxstb
Posts: 77
Joined: Sat Jul 07, 2012 11:07 pm

H264 playback issues

Wed Aug 29, 2012 11:56 pm

Hi all,

I'm working on an application to play back live DVB streams (H264 and MPEG-2) and am having problems with H264 playback that I have been unable to resolve.

My application acts as a client for https://www.lonelycoder.com/tvheadend/ and communication is done via tvheadend's own "htsp" protocol. tvheadend demuxes the video and audio streams and sends complete packets in htsp messages.

My problem is that H264 streams sometimes fail to start at all or sometimes start after a few seconds (the longest wait can be up to about 5-10 seconds).

The playback code is currently just the hello_video sample with the file reading replaced by code to read from the htsp ringbuffer in my application. As I said, this works fine for some H264 streams and (thanks again!) for all MPEG-2 streams.

The following links are to two dumps I've made from my application of the received H264 streams. The first (bbchd-sat.h264 - the satellite DVB-S2 version of BBC HD) fails to play with the hello_video sample, and the second (bbchd-terr.h264 - the terrestrial DVB-T2 version of BBC HD) plays fine.

I don't have any tools to analyse these streams in detail (anyone recommend any Linux tools for this?), but I can see that they both start with SPS and PPS packets, which I first suspected may be the issue.

Trying both files with omxplayer, the "terr" version plays fine. The "sat" version plays, but very stuttery, and perhaps at half the real framerate.

Can anyone see what the difference is between these two samples, or advise how I can fix playback in the hello_video sample?

Thanks.

Links:

http://linuxstb.cream.org/bbchd-sat.h264
http://linuxstb.cream.org/bbchd-terr.h264

adb
Posts: 1
Joined: Thu Aug 30, 2012 5:51 pm

Re: H264 playback issues

Thu Aug 30, 2012 6:11 pm

Hi,
I had this problem too - it's caused by error concealment being on by default.
Try adding this just after the "int first_packet = 1;" line in video.c:

Code: Select all

OMX_PARAM_BRCMVIDEODECODEERRORCONCEALMENTTYPE ec;
memset (&ec, 0, sizeof ec);
ec.nSize = sizeof ec;
ec.nVersion.nVersion = OMX_VERSION;
ec.bStartWithValidFrame = OMX_FALSE;
OMX_SetParameter(ILC_GET_HANDLE(video_decode), OMX_IndexParamBrcmVideoDecodeErrorConcealment, &ec);

linuxstb
Posts: 77
Joined: Sat Jul 07, 2012 11:07 pm

Re: H264 playback issues

Fri Aug 31, 2012 12:00 am

Hi adb,

Thanks a lot for the tip - I don't think I would have found that by myself. Everything now seems to be playing smoothly.

Dave.

Return to “OpenMAX”