[FFmpeg-devel] [PATCH] Ignore invalid sprop-parameter-sets missing PPS

Andrew Shulgin andrewshulginua at gmail.com
Mon Feb 29 14:10:41 CET 2016


Extracting SPS without the missig PPS results in unplayable FLV.

ffmpeg -thread_queue_size 512 -rtsp_transport tcp -i rtsp://
admin:12345 at 192.88.99.1/h264/ch1/main/av_stream -ar 44100 -ac 2 -acodec
pcm_s16le -f s16le -ac 2 -i /dev/zero -c:v copy -acodec aac -strict
experimental -ab 128k -f flv wrong.flv

Uploaded to upload.ffmpeg.org with filename
rtsp-invalid-sprop-parameter-sets.flv

Also you may download the sample from here:
http://home.rmrf.co/storage/rtsp-invalid-sprop-parameter-sets.flv

On Mon, Feb 29, 2016 at 2:47 PM, Michael Niedermayer <michael at niedermayer.cc
> wrote:

> On Mon, Feb 29, 2016 at 01:59:22PM +0200, Andrew Shulgin wrote:
> > Corrected the patch a bit, now setting extradata_size to 0
> >
> > On Mon, Feb 29, 2016 at 1:13 PM, Andrew Shulgin <
> andrewshulginua at gmail.com>
> > wrote:
> >
> > > Correct SPS and PPS are in the stream.
> > > Maybe it's reasonale to use existing SPS. But i'm not sure how to
> > > implement that.
> > > Yeah really, setting extradata_size to 0 should not be skipped.
> > >
> > > On Mon, Feb 29, 2016 at 1:01 PM, Michael Niedermayer <
> > > michael at niedermayer.cc> wrote:
> > >
> > >> On Sat, Feb 27, 2016 at 09:56:01PM +0200, Andrew Shulgin wrote:
> > >> > Some Hikvison RTSP cameras send wrong sprop-parameter-sets in SDP -
> it's
> > >> > missing PPS.
> > >> >
> > >> > Example of correct sprop-parameter-sets:
> > >> > sprop-parameter-sets=Z0IAH5W4PASaEAAAcIAAFfkAQA==,aM48gA==
> > >> > Example of wrong sprop-parameter-sets:
> > >> > sprop-parameter-sets=Z0IAH5WoPASaEAAAcIAAFfkIQA==,
> > >> >
> > >> > My patch adds a workaround that ignores invalid
> sprop-parameter-sets.
> > >>
> > >> from where does it get the correct parameter set ?
> > >> is it in the stream ? or repeated sprop-parameter-sets ?
> > >>
> > >> also shuldnt the sps be used instead of skipped?
> > >> or the skip code be made conditional on codec->extradata_size > 0 ?
> > >>
> > >> [...]
> > >> --
> > >> Michael     GnuPG fingerprint:
> 9FF2128B147EF6730BADF133611EC787040B0FAB
> > >>
> > >> Complexity theory is the science of finding the exact solution to an
> > >> approximation. Benchmarking OTOH is finding an approximation of the
> exact
> > >>
> > >> _______________________________________________
> > >> ffmpeg-devel mailing list
> > >> ffmpeg-devel at ffmpeg.org
> > >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >>
> > >>
> > >
>
> >  rtpdec_h264.c |    4 ++++
> >  1 file changed, 4 insertions(+)
> > 04777111f044772997bed9c6ac4367b4a4c83952
> 0001-Ignore-invalid-sprop-parameter-sets-missing-PPS.patch
> > From 5ba47e182a47753ed47344b25fd6ba9d15698fd1 Mon Sep 17 00:00:00 2001
> > From: Andrew Shulgin <andrewshulginua at gmail.com>
> > Date: Mon, 29 Feb 2016 13:57:42 +0200
> > Subject: [PATCH] Ignore invalid sprop-parameter-sets missing PPS
> >
> > ---
> >  libavformat/rtpdec_h264.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
> > index b399be4..4c0003e 100644
> > --- a/libavformat/rtpdec_h264.c
> > +++ b/libavformat/rtpdec_h264.c
> > @@ -168,6 +168,10 @@ static int
> sdp_parse_fmtp_config_h264(AVFormatContext *s,
> >          int ret;
> >          codec->extradata_size = 0;
> >          av_freep(&codec->extradata);
> > +        if (value[strlen(value) - 1] == ',') {
> > +            av_log(s, AV_LOG_WARNING, "Missing PPS in
> sprop-parameter-sets, ignoring\n");
> > +            return 0;
> > +        }
>
> what i meant was that if there is no extradata set then extracting
> the SPS without the missig PPS into it would make sense
> while if extradata was already set then a SPS only sprop would be
> better skiped as it would remove a already extradted  PPS
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If you drop bombs on a foreign country and kill hundred thousands of
> innocent people, expect your government to call the consequence
> "unprovoked inhuman terrorist attacks" and use it to justify dropping
> more bombs and killing more people. The technology changed, the idea is
> old.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


More information about the ffmpeg-devel mailing list