[FFmpeg-user] Correct conversion of yuvj420p?

Tobias Rapp t.rapp at noa-archive.com
Fri Oct 2 16:27:48 EEST 2020

On 01.10.2020 14:16, Peter B. wrote:
> On 29.09.20 09:56, Christian Ebert wrote:
>> How about doing quick diagnosis with ffprobe before you start,
>> something like:
>> ffprobe -v error \
>> -print_format default=noprint_wrappers=1:nokey=1 \
>> -select_streams V -show_entries stream=pix_fmt
>> and make the command depend on the result?
> Thanks for the suggestion, but that actually is what I'm doing right now 
> - yet it means to treat parts of the batches with different 
> conditions/recipes.
> Additionally, in that concrete situation, the source videos (several 
> thousand...) are stored on an S3-type object based storage (non-Amazon 
> dialect). So used Mediainfo to avoid having to pull several hundred 
> Terabyte of videos just to get their tech-MD.
> And Mediainfo cannot tell me what FFmpeg considers yuvj420p, because...
> Even if it wasn't for the "S3-extra-fun", I'm running into this issue 
> every now and then in different video collections - and every "if - then 
> - else" adds extra points of failure (and work).
> You see my challenge? :)

If your main concern is having different branches of command-line 
building code, then my suggestion would be to always detect the input 
pixel format first. Then allow format mapping at the start of the 
pipeline, but disable it anywhere else:

ffmpeg -i $INPUT ... -pix_fmt +yuv420p \
  -filter:v "format=pix_fmts=yuv420p,setrange=full,..."

This should work for both cases, yuv420p and yuvj420p, and it should be 
loss-less for these two cases, but I have not actually tested.

Regards, Tobias

More information about the ffmpeg-user mailing list