Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gst-plugins-bad gst-plugins-bad
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 989
    • Issues 989
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 132
    • Merge requests 132
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GStreamer
  • gst-plugins-badgst-plugins-bad
  • Issues
  • #1694

Closed
Open
Created Jan 11, 2022 by Stepan Salenikovich@ssalenik

vtenc: color profile or gamma seems to be wrong sometimes

I have a pipeline converting a stream of jpegs (mjpegs) to an h264 RTP stream which looks something like this:

appsrc ! jpegdec ! vtenc_h264 ! rtph264pay ! appsink

The issue I have is with jpegs from some sources (not all) the colors in the resulting h264 stream are slightly off. eg: some greys appear almost white. When I run the same "pipeline" in ffmpeg on the same machine, using the same videotoolbox h264 encoder the resulting output has the correct colors, eg:

ffmpeg -i <input> -profile:v baseline -c:v h264_videotoolbox -realtime 1 -f rtp rtp://<address>

I'm wondering if this has something to do with the color profile of the jpegs. I noticed in the ffmpeg source these 3 keys can be set which seem to specify the color profile in various ways: https://github.com/FFmpeg/FFmpeg/blob/6c4074e4234edacfb3f37184fd68771df3cb2b7f/libavcodec/videotoolboxenc.c#L847-L867

see also: https://developer.apple.com/documentation/corevideo/cvimagebuffer/image_buffer_transfer_function_constants https://developer.apple.com/documentation/corevideo/cvimagebuffer/image_buffer_color_primaries_constants https://developer.apple.com/documentation/corevideo/cvimagebuffer/image_buffer_ycbcr_matrix_constants

I don't see these keys being set in vtenc.c

I'm not sure if it would make sense to set the manually, or they could be somehow derived from the source buffer.

I'm currently playing around with setting these keys manually in the vtenc.c source to see if it will fix my issue, though I'm not sure what they should be or how to parse the raw h264 stream to see what they are currently set as...

Thanks.

Assignee
Assign to
Time tracking