This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Non-existing PPS NALU from H.264 Encoder?

 

[This is a cross post from the Gstreamer Gforge forums. I'm posting here mainly because mainly my issue is related to the TI H.264 encoder. Click here to jump directly to the PPS errors)

Hi all,

I'm using a DM6467 based design (repeatable on a DM6467EVM) using MVL 4.0, DVSDK 1.40, DMAI 1.16 and gstreamer_ti 1.00. When starting a simple RTP server pipeline, shown below, I run into problems based on the order of which was started first - the client or the server. Additionally, once the client successfully connects and plays back the RTP stream, if the gstreamer-based client is paused, the stream cannot be restarted on resume. Here's how to reproduce:

Server pipeline:

 

DM6467:
gst-launch -v  v4l2src always-copy=false ! TIVidenc1 codecName=h264enc engineName=encode contiguousInputFrame=true ! rtph264pay ! udpsink port=5004 host=192.168.1.101

Test PC:

gst-launch -v videotestsrc is-live=1 ! x264enc ! rtph264pay ! udpsink host=192.168.1.101 port=5004

gst-launch -v v4l2src ! x264enc ! rtph264pay ! udpsink host=192.168.1.101 port=5004

Client pipeline/.sdp file:

[Fedora 11 machine w/gstreamer 0.10.23]

gst-launch -v udpsrc port=5004 caps="application/x-rtp, media=video, encoding-name=H264,clock-rate=90000" ! rtph264depay ! ffdec_h264 ! ffmpegcolorspace ! autovideosink

I am also using totem which is gstreamer based. The following .sdp is used:

v=0
o=- 1188340656180883 1 IN IP4 192.168.1.101
s=Session streamed by GStreamer
i=server.sh
t=0 0
a=tool:GStreamer
a=type:broadcast
m=video 5004 RTP/AVP 96
c=IN IP4 192.168.1.101
a=rtpmap:96 H264/90000
a=fmtp:96 sprop-parameter-sets=Z0KAH/QFoeiA
a=fmtp:96 profile-level-id=42801f

Totem is started from the command line with:

totem --gst-debug=ffmpeg:5 Recevier_video.sdp

Execution matrix (DM6467):

 

Order Initial connection After Pause/Resume
Server first, client second No Video No Video
Client first, serv Video No Video

 

To sum of days/weeks of research and frustration, I believe there's an issue with TI H.264 encoder.  Using similar server pipelines (shown above marked Test PC), all criteria from the above execution matrix yield video playback. The complaint from totem is:

 

0:00:13.914249694 23113 0xb501cb60 LOG                   ffmpeg gstffmpegdec.c:2231:gst_ffmpegdec_chain:<ffdec_h2641> Received new data of size 2333, ts:0:00:02.577663218, dur:99:99:99.999999999
0:00:13.914294672 23113 0xb501cb60 LOG                   ffmpeg gstffmpegdec.c:2270:gst_ffmpegdec_chain:<ffdec_h2641> Calling av_parser_parse with ts:0:00:02.577663218
0:00:13.914325961 23113 0xb501cb60 ERROR                 ffmpeg :0:: non-existing PPS referenced
0:00:13.914344119 23113 0xb501cb60 LOG                   ffmpeg gstffmpegdec.c:2279:gst_ffmpegdec_chain:<ffdec_h2641> parser returned res 0 and size 2309
0:00:13.914363116 23113 0xb501cb60 LOG                   ffmpeg gstffmpegdec.c:2285:gst_ffmpegdec_chain:<ffdec_h2641> consuming 2309 bytes. ts:0:00:02.544296551
0:00:13.914383510 23113 0xb501cb60 LOG                   ffmpeg gstffmpegdec.c:1917:gst_ffmpegdec_frame:<ffdec_h2641> data:0x868bcf0, size:2309, ts:0:00:02.577663218, dur:99:99:99.999999999
0:00:13.914408653 23113 0xb501cb60 ERROR                 ffmpeg :0:: non-existing PPS referenced
0:00:13.914426532 23113 0xb501cb60 ERROR                 ffmpeg :0:: decode_slice_header error
0:00:13.914477377 23113 0xb501cb60 ERROR                 ffmpeg :0:: no frame!
0:00:13.914501961 23113 0xb501cb60 DEBUG                 ffmpeg gstffmpegdec.c:1524:gst_ffmpegdec_video_frame:<ffdec_h2641> after decode: len -1, have_data 0
0:00:13.914520958 23113 0xb501cb60 DEBUG                 ffmpeg gstffmpegdec.c:1689:gst_ffmpegdec_video_frame:<ffdec_h2641> return flow 0, out (nil), len -1
0:00:13.914541910 23113 0xb501cb60 WARN                  ffmpeg gstffmpegdec.c:1955:gst_ffmpegdec_frame:<ffdec_h2641> ffdec_h264: decoding error (len: -1, have_data: 0)
0:00:13.914560907 23113 0xb501cb60 LOG                   ffmpeg gstffmpegdec.c:2368:gst_ffmpegdec_chain:<ffdec_h2641> Decoding error, trying next
0:00:13.914562304 23113 0xb501cb60 LOG                   ffmpeg gstffmpegdec.c:2382:gst_ffmpegdec_chain:<ffdec_h2641> Before (while bsize>0).  bsize:2333 , bdata:0x8774000
0:00:13.914604209 23113 0xb501cb60 LOG                   ffmpeg gstffmpegdec.c:2270:gst_ffmpegdec_chain:<ffdec_h2641> Calling av_parser_parse with ts:0:00:02.577663218
0:00:13.914627396 23113 0xb501cb60 LOG                   ffmpeg gstffmpegdec.c:2279:gst_ffmpegdec_chain:<ffdec_h2641> parser returned res 2333 and size 0
0:00:13.914646113 23113 0xb501cb60 LOG                   ffmpeg gstffmpegdec.c:2285:gst_ffmpegdec_chain:<ffdec_h2641> consuming 0 bytes. ts:0:00:02.577663218

 

I initially thought there was an issue with the duration length of the frame but that was misguided. Instead it's the non-existing PPS error. This is what's leading me to believe there is an encoder issue. What I believe is that the encoder is not sending the PPS NAL unit more than once (when the stream is first started) so when a client attempts to connect after the server is started, that information isn't there. Unfortunately, I'm reaching the extent of my knowledge of H.264 so I'm hoping I'm on the right track.

Has anyone run into this same issue and resolved it? Can I force the encoder from hopefully the DMAI layer to resend the PPS NALU periodically? It's not clear in the H.264 users guide (SPRUFD9) on how to configure this.

And no, I can't use MVL 5.0 which probably limits me DVSDK < 2.00. It's a licensing issue.

Thanks in advance and Happy(?) New Year!

Emile Semmes

 

  • Hello Emile,

    Best wishes for the new year.

    I can confirm the same problem on the following setup:

    • TI DM357 EVM 
    • MontaVista 4.2.0-16.0.32.0801914 2008-08-30
    • Gstreamer 0.10
    • Plugin Name: TICodecPlugin
    • Description: Plugin for TI xDM-Based Codecs
    • Filename: /opt/gstreamer/lib/gstreamer-0.10/libgstticodecplugin.so
    • Version: 0.10.0.1
    All clients exhibit the same behavior:
    Order Initial connection After 10 minutes

    Server First - Client Second                             

    non-existing PPS Referenced Error 
    Client First - Followed by Server Video Depends on Client (linux & win 7 yes, os x no)

    Clients:

    • Linux version 2.6.26-2-686 Debian 2.6.26-19lenny2 (pretty video clean after start and good sync of a/v)
    • Mac os x (Initially clean video with good sync of a/v.  Video stops within 10 minutes and audio continues)
    • Windows 7 (audio video synch problems, choppy video)

    Client pipelines all similar to below:

    gst-launch --gst-debug=3 -v gstrtpbin async-handling=true latency=0 name=rtpbin udpsrc port=5000 caps=$VCAPS ! rtpbin.recv_rtp_sink_0 rtpbin. ! rtph264depay ! ffdec_h264 ! ffmpegcolorspace ! videoscale ! queue ! ximagesink sync=false async=FALSE udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0  rtpbin.send_rtcp_src_0 ! udpsink port=5005 host=$DEST sync=false async=false udpsrc port=5002 do-timestamp=true caps=$ACAPS ! rtppcmadepay ! audio/x-alaw, rate=8000, channels=1 ! alawdec ! audioconvert ! osxaudiosink sync=false async=false 

    I will switch to mpeg4enc to see if I have similar results.

     

    Atul Davda

  • here is the remainder of the example pipeline -- 

    udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1 rtpbin.send_rtcp_src_1 ! udpsink port=5007 host=$DEST sync=false async=false

  • On the Mac after the video stops and audio continues,

    gdb reports following:

    Program received signal EXC_BAD_ACCESS, Could not access memory.

    Reason: KERN_INVALID_ADDRESS at address: 0x01ee4000

    [Switching to process 11977 thread 0x5b03]

    0x01259dda in h264_parse ()