Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Niklas Haas <ffmpeg@haasn.xyz>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] Towards YUVJ removal
Date: Fri, 9 Dec 2022 12:49:41 +0100
Message-ID: <20221209124941.GB66771@haasn.xyz> (raw)

So, as was discussed at the last meeting, we should move towards
removing YUVJ. I want to gather feedback on what appears to be to the
major hurdle, and possible ways to solve it.

The basic major issue is how to handle the case of combining limited
range input with an encoder for a format that only accepts full range
data. The common case, for example, would be converting a frame from a
typical video file to a JPEG:

$ ffmpeg -f lavfi -i smptebars -vframes 1 output.jpg

Currently, this works because the JPEG encoder only advertises YUVJ
pixel formats, and therefore ffmpeg auto-inserts swscaler to convert
from limited range to full range. But this depends on conflating color
range and pixel formats, which is exactly what has been marked
deprecated for an eternity.

Now, there are some solutions I can see for how to handle this case in
a non-YUVJ world:

1. Simply output an error, and rely on the user to insert a conversion
   filter, e.g.:

   $ ffmpeg -f lavfi -i smptebars -vframes 1 output.jpg
   error: inputs to jpeg encoder must be full range

   $ ffmpeg -f lavfi -i smptebars -vframes 1 -vf scale=out_range=jpeg output.jpg
   ... works

2. Have the JPEG encoder take care of range conversion internally, by
   using sws to convert limited to full range.

3. Allow filters to start exposing color space metadata as part of
   filter negotiation, and then auto-insert swscaler whenever colorspace
   conversion needs to happen as a result of filters not accepting the
   corresponding color metadata. This would also allow more than just
   conversion between limited/full range.

4. Combine approach 1 with an encoder flag for "supports full range
   only", and have ffmpeg.c auto-insert a scale filter as the last step
   before the encoder if this flag is set (and input is limited range).

1 would be the most explicit but would break any existing pipeline that
includes conversion to jpeg, which is probably a very large number.

2 would be the least work, but violates abstraction boundaries.

3 would be the most work and is, IMO, of questionable gain.

4 would be both explicit and not break existing workflows.

Thoughts?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

             reply	other threads:[~2022-12-09 11:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 11:49 Niklas Haas [this message]
2022-12-09 11:59 ` Jean-Baptiste Kempf
2022-12-09 12:10 ` Andreas Rheinhardt
2022-12-09 12:45   ` Niklas Haas
2022-12-09 12:55     ` Paul B Mahol
2022-12-09 13:48     ` Diederick C. Niehorster
2022-12-09 12:56 ` Hendrik Leppkes
2022-12-09 16:50 ` Michael Niedermayer
2022-12-13 11:23   ` Niklas Haas
2022-12-13 11:58     ` Nicolas George
2023-02-15  9:30 ` Martin Storsjö

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221209124941.GB66771@haasn.xyz \
    --to=ffmpeg@haasn.xyz \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git