After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 747613 - Fixes to HEVC: codecparser, videoparser, codec-utils
Fixes to HEVC: codecparser, videoparser, codec-utils
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other Linux
: Normal major
: 1.5.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-04-10 11:03 UTC by sreerenj
Modified: 2015-08-16 13:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
codecparser: h265: Fix nal size calculation for EOS and EOB (945 bytes, patch)
2015-04-10 11:14 UTC, sreerenj
committed Details | Review
codecparser: h265: Fix the NumPocTotalCurr calculation (2.50 KB, patch)
2015-04-10 11:14 UTC, sreerenj
committed Details | Review
codecparsre: h265: Fix the NumDeltaPocs calculation (1.42 KB, patch)
2015-04-10 11:15 UTC, sreerenj
committed Details | Review
codecparser: h265: skip byte alignment bits while parsing slice header (1.20 KB, patch)
2015-04-10 11:15 UTC, sreerenj
committed Details | Review
codecparsers: h2645: add helpers to convert quantization matrices (5.64 KB, patch)
2015-04-10 11:17 UTC, sreerenj
committed Details | Review
pbutils: Use more strict profile checking for hevc (1.56 KB, patch)
2015-04-30 16:40 UTC, sreerenj
committed Details | Review
codecparser: h265: Fix parsing multiple SEI messages in a singe SEI Nal (7.84 KB, patch)
2015-04-30 16:41 UTC, sreerenj
committed Details | Review
codecparser: h265: Calculate crop rectangle dimensions (2.25 KB, patch)
2015-04-30 16:41 UTC, sreerenj
committed Details | Review
codecparser: h265: Fix nal unit size checking (1.50 KB, patch)
2015-04-30 16:42 UTC, sreerenj
committed Details | Review
h265parse: Fix profile, tier and level setting in caps (3.39 KB, patch)
2015-04-30 16:43 UTC, sreerenj
committed Details | Review
h265parse: Fix the memory freeing of stored VPS nals (981 bytes, patch)
2015-04-30 16:44 UTC, sreerenj
committed Details | Review
h265parse: Fix source caps to report cropped dimensions. (1.53 KB, patch)
2015-04-30 16:44 UTC, sreerenj
committed Details | Review
h264parse: Fix profile and level setting in caps (4.46 KB, patch)
2015-05-02 19:23 UTC, sreerenj
committed Details | Review
h265parse: expose compatible profiles to downstream (4.79 KB, patch)
2015-08-07 10:06 UTC, sreerenj
committed Details | Review

Description sreerenj 2015-04-10 11:03:03 UTC
The HEVC(h265) support in gstreamer requires fixes in a number of places. This bug report is to track all of them together.
Comment 1 sreerenj 2015-04-10 11:14:09 UTC
Created attachment 301268 [details] [review]
codecparser: h265: Fix nal size calculation for EOS and EOB
Comment 2 sreerenj 2015-04-10 11:14:28 UTC
Created attachment 301269 [details] [review]
codecparser: h265: Fix the NumPocTotalCurr calculation
Comment 3 sreerenj 2015-04-10 11:15:14 UTC
Created attachment 301270 [details] [review]
codecparsre: h265: Fix the NumDeltaPocs calculation
Comment 4 sreerenj 2015-04-10 11:15:32 UTC
Created attachment 301271 [details] [review]
codecparser: h265: skip byte alignment bits while parsing slice header
Comment 5 sreerenj 2015-04-10 11:17:53 UTC
Created attachment 301272 [details] [review]
codecparsers: h2645: add helpers to convert quantization matrices
Comment 6 sreerenj 2015-04-10 11:20:57 UTC
This is only the first set of patches which are necessary for gstreamer vaapi plugins. More fixes needed in general,
1: parse sei headers properly (current implementation is broken)
2: pbutis/codec-utils : fix profile setting 
3: + a number of cases in videoparser plugin h265parser
Comment 7 Sebastian Dröge (slomo) 2015-04-26 19:47:07 UTC
Thanks, the first ones are all pushed now :)
Comment 8 Athanasios Oikonomou 2015-04-28 20:33:11 UTC
Hi, 

I get the following error when trying to play h256 file.

[code]
root@dm800se:/var/volatile/tmp# GST_DEBUG_NO_COLOR=1 GST_DEBUG=*:3 gst-launch-1.0 -v playbin uri=file:///media/usb/1/140626_720p_hm130_4s_sao_dbf_qp27.265.mkv
Setting pipeline to PAUSED ...
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: ring-buffer-max-size = 0
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-size = -1
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-duration = -1
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: use-buffering = false
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: download = false
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: uri = file:///media/usb/1/140626_720p_hm130_4s_sao_dbf_qp27.265.mkv
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: connection-speed = 0
0:00:00.227617000   579   0x649780 WARN                 basesrc gstbasesrc.c:3481:gst_base_src_start_complete:<source> pad not activated yet
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: source = "\(GstFileSrc\)\ source"
0:00:00.237162296   579   0x649780 WARN                 basesrc gstbasesrc.c:3481:gst_base_src_start_complete:<source> pad not activated yet
Pipeline is PREROLLING ...
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = "NULL"
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = "NULL"
0:00:00.599147963   579 0x76142200 WARN       codecparsers_h265 gsth265parser.c:1824:gst_h265_parse_pps: value not in allowed range. value: 0, range 1-19
0:00:00.599541963   579 0x76142200 WARN       codecparsers_h265 gsth265parser.c:1869:gst_h265_parse_pps: error parsing "Picture parameter set"
0:00:00.599739963   579 0x76142200 WARN               h265parse gsth265parse.c:562:gst_h265_parse_process_nal:<h265parse0> failed to parse PPS:
0:00:00.600066519   579 0x76142200 WARN       codecparsers_h265 gsth265parser.c:1951:gst_h265_parser_parse_slice_hdr: couldn't find associated picture parameter set with id: 0
*** Error in `gst-launch-1.0': free(): invalid pointer: 0x75365d34 ***
Aborted (core dumped)
[/code]

Above error is happening on Enigma2 STB using latest HEAD (compiled using openembedded few minutes ago). 
Currently there is no Enigma2 STB that supports h265 and there is no video sink that has h265 caps.

Here you can find above sample http://www.elecard.com/assets/files/other/clips/140626_720p_hm130_4s_sao_dbf_qp27.265
Comment 9 sreerenj 2015-04-29 12:19:39 UTC
(In reply to Athanasios Oikonomou from comment #8)
> Hi, 
> 
> I get the following error when trying to play h256 file.
> 
> [code]
> root@dm800se:/var/volatile/tmp# GST_DEBUG_NO_COLOR=1 GST_DEBUG=*:3
> gst-launch-1.0 -v playbin
> uri=file:///media/usb/1/140626_720p_hm130_4s_sao_dbf_qp27.265.mkv
> Setting pipeline to PAUSED ...
> /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: ring-buffer-max-size = 0
> /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-size = -1
> /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-duration = -1
> /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: use-buffering = false
> /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: download = false
> /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: uri =
> file:///media/usb/1/140626_720p_hm130_4s_sao_dbf_qp27.265.mkv
> /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: connection-speed = 0
> 0:00:00.227617000   579   0x649780 WARN                 basesrc
> gstbasesrc.c:3481:gst_base_src_start_complete:<source> pad not activated yet
> /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: source =
> "\(GstFileSrc\)\ source"
> 0:00:00.237162296   579   0x649780 WARN                 basesrc
> gstbasesrc.c:3481:gst_base_src_start_complete:<source> pad not activated yet
> Pipeline is PREROLLING ...
> /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/
> GstTypeFindElement:typefind.GstPad:src: caps = "NULL"
> /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/
> GstTypeFindElement:typefind.GstPad:src: caps = "NULL"
> 0:00:00.599147963   579 0x76142200 WARN       codecparsers_h265
> gsth265parser.c:1824:gst_h265_parse_pps: value not in allowed range. value:
> 0, range 1-19
> 0:00:00.599541963   579 0x76142200 WARN       codecparsers_h265
> gsth265parser.c:1869:gst_h265_parse_pps: error parsing "Picture parameter
> set"
> 0:00:00.599739963   579 0x76142200 WARN               h265parse
> gsth265parse.c:562:gst_h265_parse_process_nal:<h265parse0> failed to parse
> PPS:
> 0:00:00.600066519   579 0x76142200 WARN       codecparsers_h265
> gsth265parser.c:1951:gst_h265_parser_parse_slice_hdr: couldn't find
> associated picture parameter set with id: 0
> *** Error in `gst-launch-1.0': free(): invalid pointer: 0x75365d34 ***
> Aborted (core dumped)
> [/code]
> 
> Above error is happening on Enigma2 STB using latest HEAD (compiled using
> openembedded few minutes ago). 
> Currently there is no Enigma2 STB that supports h265 and there is no video
> sink that has h265 caps.
> 
> Here you can find above sample
> http://www.elecard.com/assets/files/other/clips/
> 140626_720p_hm130_4s_sao_dbf_qp27.265

Do you mean, these patches introduced regression???

There are surely more stuffs which needs to be fixed: couple of things are fixed already in the codecparser that I maintain.
https://github.com/01org/gstreamer-codecparsers/commits/master
There are fixes in codedparser and videoparser plugin. Not yet complete though. 

Also I have noticed that the h265 elementary streams are not at all working with software decoder ;)
Comment 10 Athanasios Oikonomou 2015-04-29 13:00:59 UTC
(In reply to sreerenj from comment #9)

> Do you mean, these patches introduced regression???

Most probably h265parser had already that issue.

Do you want me to create separate bug to track above issue or it's ok here?

PS. Can you reproduce it using above sample?
Comment 11 sreerenj 2015-04-29 13:38:44 UTC
(In reply to Athanasios Oikonomou from comment #10)
> (In reply to sreerenj from comment #9)
> 
> > Do you mean, these patches introduced regression???
> 
> Most probably h265parser had already that issue.
> 
> Do you want me to create separate bug to track above issue or it's ok here?
> 
> PS. Can you reproduce it using above sample?

Yes, reproducible . But I prefer you to create a separate bug for this (please add me to cc). Once I get time to fix all other known issues, will try this sample again (not immediate though).
Comment 12 sreerenj 2015-04-30 16:40:47 UTC
Created attachment 302675 [details] [review]
pbutils: Use more strict profile checking for hevc
Comment 13 sreerenj 2015-04-30 16:41:30 UTC
Created attachment 302676 [details] [review]
codecparser: h265: Fix parsing multiple SEI messages in a singe SEI Nal
Comment 14 sreerenj 2015-04-30 16:41:58 UTC
Created attachment 302677 [details] [review]
codecparser: h265: Calculate crop rectangle dimensions
Comment 15 sreerenj 2015-04-30 16:42:55 UTC
Created attachment 302678 [details] [review]
codecparser: h265: Fix nal unit size checking
Comment 16 sreerenj 2015-04-30 16:43:34 UTC
Created attachment 302679 [details] [review]
h265parse: Fix profile, tier and level setting in caps
Comment 17 sreerenj 2015-04-30 16:44:09 UTC
Created attachment 302680 [details] [review]
h265parse: Fix the memory freeing of stored VPS nals
Comment 18 sreerenj 2015-04-30 16:44:51 UTC
Created attachment 302681 [details] [review]
h265parse: Fix source caps to report cropped dimensions.
Comment 19 Sebastian Dröge (slomo) 2015-04-30 19:47:08 UTC
Comment on attachment 302677 [details] [review]
codecparser: h265: Calculate crop rectangle dimensions

Might make sense to also sanity check here maybe? That e.g. sps->width is bigger than the value we subtract there.
Comment 20 Sebastian Dröge (slomo) 2015-04-30 19:49:04 UTC
Comment on attachment 302679 [details] [review]
h265parse: Fix profile, tier and level setting in caps

Should the same also be done for h264?
Comment 21 sreerenj 2015-05-02 19:22:30 UTC
(In reply to Sebastian Dröge (slomo) from comment #20)
> Comment on attachment 302679 [details] [review] [review]
> h265parse: Fix profile, tier and level setting in caps
> 
> Should the same also be done for h264?

Yes, this should be done for h264 too..
Comment 22 sreerenj 2015-05-02 19:23:11 UTC
Created attachment 302767 [details] [review]
h264parse: Fix profile and level setting in caps
Comment 23 sreerenj 2015-08-07 10:06:20 UTC
Created attachment 308886 [details] [review]
h265parse: expose compatible profiles to downstream
Comment 24 sreerenj 2015-08-07 10:14:41 UTC
(In reply to sreerenj from comment #23)
> Created attachment 308886 [details] [review] [review]
> h265parse: expose compatible profiles to downstream

This is something we already doing for h264parse. Would be nice if we can get it in 1.6 ;)

Reason: There are "main-still-picture" profile streams out there which are playable with gstreamer-vaapi , but only with the mentioned patch....
Comment 25 Sebastian Dröge (slomo) 2015-08-07 11:12:13 UTC
commit 69becd734d3f94264f6f0ef2e6147205646c1abd
Author: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Date:   Fri Aug 7 05:58:22 2015 +0300

    h265parse: expose compatible profiles to downstream
    
    Some video bitstreams report a too restrictive set of profiles. If a video
    decoder was to strictly follow the indicated profile, it wouldn't support that
    stream, whereas it could in theory and in practice. So we should relax the
    profile restriction for allowing the decoder to get connected with parser.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747613
Comment 26 sreerenj 2015-08-07 11:16:45 UTC
(In reply to Sebastian Dröge (slomo) from comment #25)
> commit 69becd734d3f94264f6f0ef2e6147205646c1abd
> Author: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
> Date:   Fri Aug 7 05:58:22 2015 +0300
> 
>     h265parse: expose compatible profiles to downstream
>     
>     Some video bitstreams report a too restrictive set of profiles. If a
> video
>     decoder was to strictly follow the indicated profile, it wouldn't
> support that
>     stream, whereas it could in theory and in practice. So we should relax
> the
>     profile restriction for allowing the decoder to get connected with
> parser.
>     
>     https://bugzilla.gnome.org/show_bug.cgi?id=747613

That was fast ! thanks :)