mbox series

[FFmpeg-devel,0/4] ffmpeg: late A/V encoder init, AVFrame metadata usage

Message ID 20200911161107.24870-1-jeebjp@gmail.com
Headers show
Series ffmpeg: late A/V encoder init, AVFrame metadata usage
Related show

Message

Jan Ekström Sept. 11, 2020, 4:11 p.m. UTC
This patch set started with a very simple wish to not have to set color
related values manually each time when utilizing ffmpeg.c.

I do not have the whole FATE suite locally, so most likely some test will
fail due to expectations of the metadata not being set for video - or due to
me failing to handle all cases nicely. Still, I thought this was useful enough
to post on the mailing list for review.

Currently limited to using values for video, but the same capabilities are
now available to audio, as I saw no real reason to special case video only.

This probably fixes some trac issues, but with a quick look I couldn't find
anything that explicitly was due to lack of video color metadata passthrough.


Jan


Example 1:

I have an RGB 3-D render, which I would like to encode into BT.709 YCbCr.
The video filter I'm generally using for this (zscale) does flag the matrix in
the output AVFrame.

Yet to have the video encoder have the correct metadata set, I have to
set the value(s) manually.

With this patch set, the value(s) from the first AVFrame fed to do_video_out
will be utilized.

Example 2:

I have an input video that sets one or more of the following:
matrix/primaries/transfer function/range/chroma location.

I just want to re-encode it. All of this metadata gets stripped.

With this patch set, the value(s) from the first AVFrame fed to do_video_out
will be utilized.

Example 3:

I have a video which has incorrect metadata tagged. Before, I had to set
the correct data data manually.

With this patch set, since ffmpeg.c takes color related options as dictionary
keys, the AVFrame values will only be utilized if the user has not set the
option for a given stream. Thus, this use case still works.


Jan Ekström (4):
  ffmpeg: deduplicate init_output_stream usage logic
  ffmpeg: move A/V non-streamcopy initialization to a later point
  ffmpeg: pass decoded or filtered AVFrame to output stream
    initialization
  ffmpeg: warn if an encoder has to be initialized without an AVFrame

 fftools/ffmpeg.c | 108 ++++++++++++++++++++++++++++++++---------------
 1 file changed, 73 insertions(+), 35 deletions(-)