Answers.Body: <p>The expression used for the blend filter is same formula as used in the grainextract blend mode, but faster processing than expression.
  For error about mismatched dimensions, it can not be seen as ffmpeg output was partially trimmed, but likely by guessing cover.jpg stream may get picked instead.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-23T19:24:23.213Z
Answers.Text: Wow, that was it! I'd never have guessed the stupid cover art could get picked as an input stream over the actual video. Weird!
Answers.UserDisplayName: kshetline
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-23T14:50:45.690Z
Answers.LastActivityDate: 2024-11-23T14:50:45.690Z
Answers.UserDisplayName: helper_guest
Body: <p>Here's the command I'm issuing:</p>
  <p><code>ffmpeg -i orig.mkv -i compressed.mkv -filter_complex &quot;format=gbrp,blend=all_expr='clip(B-A+128,0,255)'&quot; -c:v libx264 -crf 18 -c:a copy -pix_fmt yuv420p diff.mkv</code></p>
  <p>This is a command I've used successfully in the past to show the differences between two video streams and extract the changes caused by extra compression.</p>
  <p>And here's the error message:</p>
  <pre><code>[Parsed_blend_1 @ 000001590b495e00] First input link top parameters (size 3840x1606) do not match the corresponding second input link bottom parameters (size 384x216)
  [Parsed_blend_1 @ 000001590b495e00] Failed to configure output pad on Parsed_blend_1
  [fc#0 @ 0000015979fba440] Error reinitializing filters!
  Failed to inject frame into filter network: Invalid argument
  Error while filtering: Invalid argument
  [out#0/matroska @ 000001597a9bd280] Nothing was written into output file, because at least one of its streams received no packets.
  </code></pre>
  <p>Here's what <code>mediainfo</code> says about both .mkv files, showing that both files are 3840x1606:</p>
  <pre><code>PS C:\Users\kshetline\Videos&gt; mediainfo .\orig.mkv
  General
  Unique ID                                : 9446412332079049372097753225719001000 (0x71B5016224D9F6BE16AAE45DF912FA8)
  Complete name                            : .\orig.mkv
  Format                                   : Matroska
  Format version                           : Version 4
  File size                                : 9.74 GiB
  Duration                                 : 57 min 14 s
  Overall bit rate                         : 24.3 Mb/s
  Frame rate                               : 23.976 FPS
  Encoded date                             : 2024-11-23 05:26:40 UTC
  Writing application                      : mkvmerge v88.0 ('All I Know') 64-bit
  Writing library                          : libebml v1.4.5 + libmatroska v1.7.1
  Cover                                    : Yes
  Attachments                              : cover.png
  
  Video
  ID                                       : 1
  Format                                   : HEVC
  Format/Info                              : High Efficiency Video Coding
  Format profile                           : Main 10@L5@High
  HDR format                               : SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
  Codec ID                                 : V_MPEGH/ISO/HEVC
  Duration                                 : 57 min 14 s
  Bit rate                                 : 24.3 Mb/s
  Width                                    : 3 840 pixels
  Height                                   : 1 606 pixels
  Display aspect ratio                     : 2.40:1
  Frame rate mode                          : Constant
  Frame rate                               : 23.976 FPS
  Color space                              : YUV
  Chroma subsampling                       : 4:2:0 (Type 2)
  Bit depth                                : 10 bits
  Bits/(Pixel*Frame)                       : 0.165
  Stream size                              : 9.74 GiB (100%)
  Language                                 : English
  Default                                  : Yes
  Forced                                   : No
  Color range                              : Limited
  Color primaries                          : BT.2020
  Transfer characteristics                 : PQ
  Matrix coefficients                      : BT.2020 non-constant
  Mastering display color primaries        : Display P3
  Mastering display luminance              : min: 0.0050 cd/m2, max: 1000 cd/m2
  Maximum Content Light Level              : 651 cd/m2
  Maximum Frame-Average Light Level        : 149 cd/m2
  </code></pre>
  <pre><code>PS C:\Users\kshetline\Videos&gt; mediainfo .\compressed.mkv
  General
  Unique ID                                : 234272370250203591951773295296114907365 (0xB03F37A105851AC1E943E4E30A44D8E5)
  Complete name                            : .\compressed.mkv
  Format                                   : Matroska
  Format version                           : Version 4
  File size                                : 640 MiB
  Duration                                 : 57 min 14 s
  Overall bit rate                         : 1 562 kb/s
  Frame rate                               : 23.976 FPS
  Encoded date                             : 2024-11-23 05:26:08 UTC
  Writing application                      : mkvmerge v88.0 ('All I Know') 64-bit
  Writing library                          : libebml v1.4.5 + libmatroska v1.7.1
  
  Video
  ID                                       : 1
  Format                                   : HEVC
  Format/Info                              : High Efficiency Video Coding
  Format profile                           : Main 10@L5@Main
  HDR format                               : SMPTE ST 2086, HDR10 compatible / SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
  Codec ID                                 : V_MPEGH/ISO/HEVC
  Duration                                 : 57 min 14 s
  Bit rate                                 : 1 561 kb/s
  Width                                    : 3 840 pixels
  Height                                   : 1 606 pixels
  Display aspect ratio                     : 2.40:1
  Frame rate mode                          : Constant
  Frame rate                               : 23.976 (24000/1001) FPS
  Color space                              : YUV
  Chroma subsampling                       : 4:2:0 (Type 2)
  Bit depth                                : 10 bits
  Bits/(Pixel*Frame)                       : 0.011
  Stream size                              : 639 MiB (100%)
  Writing library                          : x265 3.6+1-aa7f602f7:[Windows][GCC 13.2.0][64 bit] 10bit
  Encoding settings                        : cpuid=1111039 / frame-threads=5 / numa-pools=32 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x1606 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / repeat-headers / annexb / no-aud / no-eob / no-eos / no-hrd / info / hash=0 / temporal-layers=0 / open-gop / min-keyint=24 / keyint=240 / gop-lookahead=0 / bframes=4 / b-adapt=0 / b-pyramid / bframe-bias=0 / rc-lookahead=15 / lookahead-slices=8 / scenecut=40 / no-hist-scenecut / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=2 / limit-refs=3 / no-limit-modes / me=1 / subme=2 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=2 / selective-sao=4 / no-early-skip / rskip / fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=18.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=9 / transfer=16 / colormatrix=9 / chromaloc=1 / chromaloc-top=2 / chromaloc-bottom=2 / display-window=0 / master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,50) / cll=651,149 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / hdr10 / hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass / no-mcstf / no-sbrc
  Default                                  : Yes
  Forced                                   : No
  Color range                              : Limited
  Color primaries                          : BT.2020
  Transfer characteristics                 : PQ
  Matrix coefficients                      : BT.2020 non-constant
  Mastering display color primaries        : Display P3
  Mastering display luminance              : min: 0.0050 cd/m2, max: 1000 cd/m2
  Maximum Content Light Level              : 651
  MaxCLL_Original                          : 651 cd/m2
  Maximum Frame-Average Light Level        : 149
  MaxFALL_Original                         : 149 cd/m2
  </code></pre>
  <p>I have no idea where the <code>(size 384x216)</code> in the error message comes from, as if the width of the second video is only a tenth of its real width and the height is about 13% what it should be. When both videos are played using VLC they occupy exactly the same screen size viewed with no scaling.</p>
  <p>I don't see any mismatched screen or pixel aspect ratio info either.</p>
  
Tags: <ffmpeg>
Title: ffmeg: Error message about two video streams not matching in size even though they actually do match
UserDisplayName: kshetline
ThreadText: # ffmeg: Error message about two video streams not matching in size even though they actually do match
  
  (Asked by: username_0 on 2024-11-23)
  
  Here's the command I'm issuing:
  
  `ffmpeg -i orig.mkv -i compressed.mkv -filter_complex "format=gbrp,blend=all_expr='clip(B-A+128,0,255)'" -c:v libx264 -crf 18 -c:a copy -pix_fmt yuv420p diff.mkv`
  
  This is a command I've used successfully in the past to show the differences between two video streams and extract the changes caused by extra compression.
  
  And here's the error message:
  
  ```
  [Parsed_blend_1 @ 000001590b495e00] First input link top parameters (size 3840x1606) do not match the corresponding second input link bottom parameters (size 384x216)
  [Parsed_blend_1 @ 000001590b495e00] Failed to configure output pad on Parsed_blend_1
  [fc#0 @ 0000015979fba440] Error reinitializing filters!
  Failed to inject frame into filter network: Invalid argument
  Error while filtering: Invalid argument
  [out#0/matroska @ 000001597a9bd280] Nothing was written into output file, because at least one of its streams received no packets.
  
  ```
  
  Here's what `mediainfo` says about both .mkv files, showing that both files are 3840x1606:
  
  ```
  PS C:\Users\username_0\Videos> mediainfo .\orig.mkv
  General
  Unique ID                                : 9446412332079049372097753225719001000 (0x71B5016224D9F6BE16AAE45DF912FA8)
  Complete name                            : .\orig.mkv
  Format                                   : Matroska
  Format version                           : Version 4
  File size                                : 9.74 GiB
  Duration                                 : 57 min 14 s
  Overall bit rate                         : 24.3 Mb/s
  Frame rate                               : 23.976 FPS
  Encoded date                             : 2024-11-23 05:26:40 UTC
  Writing application                      : mkvmerge v88.0 ('All I Know') 64-bit
  Writing library                          : libebml v1.4.5 + libmatroska v1.7.1
  Cover                                    : Yes
  Attachments                              : cover.png
  
  Video
  ID                                       : 1
  Format                                   : HEVC
  Format/Info                              : High Efficiency Video Coding
  Format profile                           : Main 10@L5@High
  HDR format                               : SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
  Codec ID                                 : V_MPEGH/ISO/HEVC
  Duration                                 : 57 min 14 s
  Bit rate                                 : 24.3 Mb/s
  Width                                    : 3 840 pixels
  Height                                   : 1 606 pixels
  Display aspect ratio                     : 2.40:1
  Frame rate mode                          : Constant
  Frame rate                               : 23.976 FPS
  Color space                              : YUV
  Chroma subsampling                       : 4:2:0 (Type 2)
  Bit depth                                : 10 bits
  Bits/(Pixel*Frame)                       : 0.165
  Stream size                              : 9.74 GiB (100%)
  Language                                 : English
  Default                                  : Yes
  Forced                                   : No
  Color range                              : Limited
  Color primaries                          : BT.2020
  Transfer characteristics                 : PQ
  Matrix coefficients                      : BT.2020 non-constant
  Mastering display color primaries        : Display P3
  Mastering display luminance              : min: 0.0050 cd/m2, max: 1000 cd/m2
  Maximum Content Light Level              : 651 cd/m2
  Maximum Frame-Average Light Level        : 149 cd/m2
  
  ```
  
  ```
  PS C:\Users\username_0\Videos> mediainfo .\compressed.mkv
  General
  Unique ID                                : 234272370250203591951773295296114907365 (0xB03F37A105851AC1E943E4E30A44D8E5)
  Complete name                            : .\compressed.mkv
  Format                                   : Matroska
  Format version                           : Version 4
  File size                                : 640 MiB
  Duration                                 : 57 min 14 s
  Overall bit rate                         : 1 562 kb/s
  Frame rate                               : 23.976 FPS
  Encoded date                             : 2024-11-23 05:26:08 UTC
  Writing application                      : mkvmerge v88.0 ('All I Know') 64-bit
  Writing library                          : libebml v1.4.5 + libmatroska v1.7.1
  
  Video
  ID                                       : 1
  Format                                   : HEVC
  Format/Info                              : High Efficiency Video Coding
  Format profile                           : Main 10@L5@Main
  HDR format                               : SMPTE ST 2086, HDR10 compatible / SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
  Codec ID                                 : V_MPEGH/ISO/HEVC
  Duration                                 : 57 min 14 s
  Bit rate                                 : 1 561 kb/s
  Width                                    : 3 840 pixels
  Height                                   : 1 606 pixels
  Display aspect ratio                     : 2.40:1
  Frame rate mode                          : Constant
  Frame rate                               : 23.976 (24000/1001) FPS
  Color space                              : YUV
  Chroma subsampling                       : 4:2:0 (Type 2)
  Bit depth                                : 10 bits
  Bits/(Pixel*Frame)                       : 0.011
  Stream size                              : 639 MiB (100%)
  Writing library                          : x265 3.6+1-aa7f602f7:[Windows][GCC 13.2.0][64 bit] 10bit
  Encoding settings                        : cpuid=1111039 / frame-threads=5 / numa-pools=32 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x1606 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / repeat-headers / annexb / no-aud / no-eob / no-eos / no-hrd / info / hash=0 / temporal-layers=0 / open-gop / min-keyint=24 / keyint=240 / gop-lookahead=0 / bframes=4 / b-adapt=0 / b-pyramid / bframe-bias=0 / rc-lookahead=15 / lookahead-slices=8 / scenecut=40 / no-hist-scenecut / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=2 / limit-refs=3 / no-limit-modes / me=1 / subme=2 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=2 / selective-sao=4 / no-early-skip / rskip / fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=18.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=9 / transfer=16 / colormatrix=9 / chromaloc=1 / chromaloc-top=2 / chromaloc-bottom=2 / display-window=0 / master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,50) / cll=651,149 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / hdr10 / hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass / no-mcstf / no-sbrc
  Default                                  : Yes
  Forced                                   : No
  Color range                              : Limited
  Color primaries                          : BT.2020
  Transfer characteristics                 : PQ
  Matrix coefficients                      : BT.2020 non-constant
  Mastering display color primaries        : Display P3
  Mastering display luminance              : min: 0.0050 cd/m2, max: 1000 cd/m2
  Maximum Content Light Level              : 651
  MaxCLL_Original                          : 651 cd/m2
  Maximum Frame-Average Light Level        : 149
  MaxFALL_Original                         : 149 cd/m2
  
  ```
  
  I have no idea where the `(size 384x216)` in the error message comes from, as if the width of the second video is only a tenth of its real width and the height is about 13% what it should be. When both videos are played using VLC they occupy exactly the same screen size viewed with no scaling.
  
  I don't see any mismatched screen or pixel aspect ratio info either.
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-11-23. Score: 1 | Accepted answer
  
  The expression used for the blend filter is same formula as used in the grainextract blend mode, but faster processing than expression.
  For error about mismatched dimensions, it can not be seen as ffmpeg output was partially trimmed, but likely by guessing cover.jpg stream may get picked instead.
  
  > **Comments:**
  > **username_0**: Wow, that was it! I'd never have guessed the stupid cover art could get picked as an input stream over the actual video. Weird!  
  
  ---
  
  