[FFmpeg-user] seeking help using filter colorspace when -f concat is input (it aborts)

hydra3333 at gmail.com hydra3333 at gmail.com
Thu Mar 2 05:27:37 EET 2023


Hello.  Video filter 'colorspace' aborts with "Unsupported input primaries 2 (unknown)" with -f concat as input.

Is there a way to set/force those things between the filters 'scale' and colorspace (or between input and the first filter) so that
colorspace works ?
In the examples below, bt470bg is specified, however one could imagine bt709 etc.

Or, perhaps, is there a way to force -f concat to deliver nominated colorspace/primaries/transfer_characteristics ?

Advice would be greatly valued.

Thank you.

1. This works

"ffmpeg_OpenCL.exe"  -hide_banner -v info -stats -reinit_filter 0 -safe 0 -auto_convert 1 
-f concat -i "G:\DVD\PAT-SLIDESHOWS\2004\2004-ffmpeg-concat-input-2023.03.02.13.32.28.09-3900X.txt" 
-sws_flags lanczos+accurate_rnd+full_chroma_int+full_chroma_inp 
-filter_complex
"format=yuv420p,scale=1920:1080:interl=0:eval=frame:flags=lanczos+accurate_rnd+full_chroma_int+full_chroma_inp:force_original_aspect
_ratio=decrease:out_color_matrix=bt470bg:out_range=tv,pad=1920:1080:(ow-iw)/2:(oh-ih)/2:eval=frame:color=black,settb=expr=1/25,setpt
s=4*N/TB,setdar=16/9" 
-colorspace bt470bg -color_primaries bt470bg -color_trc gamma28 
-strict experimental 
-c:v h264_nvenc -preset p7 -multipass fullres -forced-idr 1 -g 25 -coder:v cabac -spatial-aq 1 -temporal-aq 1 -dpb_size 0 -bf:v 0
-bf:v 3 -b_ref_mode:v 0 -rc:v vbr -cq:v 0 -b:v 9000000 -minrate:v 3000000 -maxrate:v 15000000 -bufsize 15000000 
-profile:v high -level 5.2 -movflags +faststart+write_colr 
-an -y "G:\DVD\PAT-SLIDESHOWS\2004\2004.slideshow.HQ.mp4" 
Input #0, concat, from 'G:\DVD\PAT-SLIDESHOWS\2004\2004-ffmpeg-concat-input-2023.03.02.13.32.28.09-3900X.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 2032x1524, 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 (mjpeg) -> format:default
  setdar:default -> Stream #0:0 (h264_nvenc)
Press [q] to stop, [?] for help
[swscaler @ 000002925d414d00] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 3 times
Output #0, mp4, to 'G:\DVD\PAT-SLIDESHOWS\2004\2004.slideshow.HQ.mp4':
  Metadata:
    encoder         : Lavf60.2.100
  Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt470bg, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 9000
kb/s, 25 fps, 12800 tbn
    Metadata:
      encoder         : Lavc60.2.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 15000000/0/9000000 buffer size: 15000000 vbv_delay: N/A
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
[graph 0 input from stream 0:0 @ 000002925c9a8500] filter context - w: 2032 h: 1524 fmt: 12, incoming frame - w: 2032 h: 1354 fmt:
12 pts_time: 0.04
[graph 0 input from stream 0:0 @ 000002925c9a8500] Changing video frame properties on the fly is not supported by all filters.


2. This aborts (same commandline but with added filter: colorspace=all=bt470bg:range=tv:fast=0)

"ffmpeg_OpenCL.exe"  -hide_banner -v info -stats -reinit_filter 0 -safe 0 -auto_convert 1 
-f concat -i "G:\DVD\PAT-SLIDESHOWS\2004\2004-ffmpeg-concat-input-2023.03.02.13.40.02.27-3900X.txt" 
-sws_flags lanczos+accurate_rnd+full_chroma_int+full_chroma_inp 
-filter_complex
"format=yuv420p,scale=1920:1080:interl=0:eval=frame:flags=lanczos+accurate_rnd+full_chroma_int+full_chroma_inp:force_original_aspect
_ratio=decrease:out_color_matrix=bt470bg:out_range=tv,pad=1920:1080:(ow-iw)/2:(oh-ih)/2:eval=frame:color=black,settb=expr=1/25,setpt
s=4*N/TB,colorspace=all=bt470bg:range=tv:fast=0,setdar=16/9" 
-colorspace bt470bg -color_primaries bt470bg -color_trc gamma28 
-strict experimental 
-c:v h264_nvenc -preset p7 -multipass fullres -forced-idr 1 -g 25 -coder:v cabac -spatial-aq 1 -temporal-aq 1 -dpb_size 0 -bf:v 0
-bf:v 3 -b_ref_mode:v 0 -rc:v vbr -cq:v 0 -b:v 9000000 -minrate:v 3000000 -maxrate:v 15000000 -bufsize 15000000 
-profile:v high -level 5.2 -movflags +faststart+write_colr 
-an -y "G:\DVD\PAT-SLIDESHOWS\2004\2004.slideshow.HQ.mp4" 
Input #0, concat, from 'G:\DVD\PAT-SLIDESHOWS\2004\2004-ffmpeg-concat-input-2023.03.02.13.40.02.27-3900X.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 2032x1524, 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 (mjpeg) -> format:default
  setdar:default -> Stream #0:0 (h264_nvenc)
Press [q] to stop, [?] for help
[swscaler @ 000001b79ec5b240] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 3 times
[Parsed_colorspace_5 @ 000001b79e231cc0] Unsupported input primaries 2 (unknown)
Error while filtering: Invalid argument
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 7130 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20230302/042ce5ab/attachment.bin>


More information about the ffmpeg-user mailing list