Answers.Body: <p>I was also going down this rabbit hole and found that there's an option <code>-attach filename</code> that's more specific to <code>mkv</code> files. It's at the end of the &quot;Main Options&quot; section of the manual: <a href="https://ffmpeg.org/ffmpeg.html#Main-options" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg.html#Main-options</a></p>
  <pre><code>ffmpeg -i video.mkv -attach cover.jpg -metadata:s:t:0 mimetype=image/jpeg -c copy out.mkv
  </code></pre>
  <p>The <code>-metadata:s:t:0</code> specifically selects the first attachment stream (which should be just the cover photo).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-06T05:20:19.897Z
Answers.Text: This works but I still would like to remind that **the thumbnail image must have "cover" as its file name**, such as "cover.jpg" or "cover.png". If we use file names like "thumb.png", FFmpeg won't report an error, but the thumbnail also won't display properly on the MKV output.
Answers.UserDisplayName: wklchris
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-07-13T20:52:37.570Z
Answers.Text: How to do this in Windows, it doesn't work for me in Windows 11...
Answers.UserDisplayName: Ricardo Bohner
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-17T23:29:54.913Z
Answers.Text: @RicardoBohner Windows seems to not read MKV cover art. I use third-party software like Icaros to replace Windows built-in thumbnail provider. (But Windows can read MP3 and MP4 cover art...)
Answers.UserDisplayName: rint
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-17T23:56:55.893Z
Answers.Text: @rint I noticed, when I open the movie in VLC media player and press CTRL + I I can actually see the thumbnail, but it doesn't show on File Explorer https://i.imgur.com/qbStjay.jpeg
Answers.UserDisplayName: Ricardo Bohner
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-18T12:29:45.223Z
Answers.Text: @RicardoBohner Based on the software I think, PotPlayer cannot display the embedded thumbnail.
Answers.UserDisplayName: rint
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-23T11:49:25.663Z
Answers.LastActivityDate: 2022-11-23T11:49:25.663Z
Answers.UserDisplayName: Samuel Powell
Answers.Body: <p>It turns out that the Matroska format also demands that the image ( ONLY a .jpg or a .png can be used ) must not only be named &quot;cover.jpg&quot; or &quot;cover.png&quot;; there is an obscure ADDITIONAL REQUIREMENT that the cover image's smallest dimension ( width or height ) MUST BE NO LARGER THAN 600 PIXELS!
  The relevant Matroska specification is here:
  <a href="https://www.matroska.org/technical/attachments.html" rel="nofollow noreferrer">https://www.matroska.org/technical/attachments.html</a> Here's a back-up copy of the same page of the spec at the Internet Archive's Wayback Machine:
  <a href="https://web.archive.org/web/20240918125616/https://www.matroska.org/technical/attachments.html" rel="nofollow noreferrer">https://web.archive.org/web/20240918125616/https://www.matroska.org/technical/attachments.html</a></p>
  <p>Read the specification closely!  If your cover image file has a square or portrait mode orientation, you can simply use the &quot;cover.ext&quot; naming convention for the file.
  BUT if your cover image file has a LANDSCAPE mode orientation, the Matroska spec says you <em>SHOULD</em> use the suffix &quot;_land&quot; on the filename(!!!), like this: &quot;cover_land.ext&quot; ( &quot;cover_land.jpg&quot; or &quot;cover_land.png&quot;, depending upon your filetype ).</p>
  <p>AND... The Matroska spec ALSO says you may include 1 smaller thumbnail image if you want to, with a shortest dimension no greater than 120 pixels!  The normal size cover image must be the 1st attachment, though, and the smaller thumbnail is required to follow a &quot;small_&quot; prefix naming convention: &quot;small_cover.ext&quot; or &quot;small_cover_land.ext&quot;</p>
  <p>Resize an image with ffmpeg
  To retain aspect ratio:</p>
  <pre><code>ffmpeg -i art_image_for_use_as_cover.jpg -vf scale=&quot;-1:600&quot; cover.jpg
  </code></pre>
  <p>or if you want to resize based on input width and height, where '2' is used in both dimensions here to shrink them down by 1/2</p>
  <pre><code>ffmpeg -i input_art_image.png -vf scale=&quot;iw/2:ih/2&quot; cover.png
  </code></pre>
  <p>where ( this happens automatically, you don't need to replace &quot;iw&quot; or &quot;ih&quot; in that command )</p>
  <ul>
  <li>iw: input width</li>
  <li>ih: input height</li>
  </ul>
  <p>Here's where the FFMPEG manual describes &quot;scaling&quot; and the parameters you can use:
  <a href="https://ffmpeg.org/ffmpeg-filters.html#scale-1" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg-filters.html#scale-1</a></p>
  <p>If by some chance you're also <a href="https://github.com/yt-dlp/yt-dlp" rel="nofollow noreferrer">using YT-DLP to get videos from YouTube</a>, you can command yt-dlp to grab the images of various sizes that it uses for a particular video with this --write-all-thumb command option:</p>
  <pre><code>&quot;C:\yt-dlp\yt-dlp.exe&quot; --skip-download --write-all-thumb https://www.youtube.com/watch?v=mRtKmFknE0o
  </code></pre>
  <p>The --skip-download option will prevent yt-dlp from downloading the actual video file, but --write-all-thumb will give you the entire set of thumbnails for that video in various sizes, in both .jpg and .webp formats, sequentially numbered from smallest to largest.  There is currently ( in 2024 ) no method to retrieve just 1 specific size, you have to download the entire set ( about 42 images ) and then just delete the ones you don't need.</p>
  <p>It turns out that for this given example video, none of the widths or heights is exactly 600 pixels.  And the thumbnails of the art for this example video has black bars to the left &amp; right, which are ugly &amp; unnecessary, so we can simply crop them off.  I pick the thumbnail .jpg index numbered at 40, since that is first index of the largest size .jpg thumbnail returned, I presume it will have the most detail:</p>
  <pre><code>&quot;The Old Ways Podcast - Six Seasons in Sartar - Episode 22 - Tears of the Vale [mRtKmFknE0o].40.jpg&quot;
  </code></pre>
  <p>A higher index number, 43, also exists, but it has the same file size &amp; image width &amp; height, so I presume it is no different than #40.</p>
  <p>What the FFMPEG manual has to say about using it to crop still images &amp; video:</p>
  <p><a href="https://ffmpeg.org/ffmpeg-filters.html#crop" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg-filters.html#crop</a></p>
  <p>So to crop the black bars ( which are 280 pixels wide ) off of the #40 thumbnail of this example:</p>
  <pre><code>&quot;C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe&quot; -i &quot;The Old Ways Podcast - Six Seasons in Sartar - Episode 22 - Tears of the Vale [mRtKmFknE0o].40.jpg&quot; -vf &quot;crop=720:720:280:0&quot; cover_crop.jpg
  </code></pre>
  <p>I see that I cut off too much of the left &amp; right sides of the art, discovering my initial guess that the art width was 720 pixels wide was off.  Using Photoshop, I see the image is 1280 wide &amp; 720 pixels tall. when I use the crop tool by hand to chop off the black bars, it becomes 869 pixels wide... I did that by hand so I just round that off to nearest ten, 870 pixels wide... Then 1280 - 870 = 410 total width of black pixels were cropped out from left &amp; right, so to get the starting x position value of a proper crop with FFMPEG, we divide that by 2: 410 / 2 = 205...  <strong>It only makes sense to go to this trouble, to expend this effort, if we plan to use a batch file to crop, scale &amp; add thumbnails to LOTS of videos at once, or many, many times in the future!</strong></p>
  <p>The cropping command looks like this, generically:</p>
  <pre><code>&quot;C:\Path_To_FFMPEG\ffmpeg.exe&quot; -i input_image.jpg -vf &quot;crop=720:720:280:0&quot; output_image.jpg 
  </code></pre>
  <p>Cropping in my specific example case:</p>
  <pre><code>&quot;C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe&quot; -i &quot;The Old Ways Podcast - Six Seasons in Sartar - Episode 22 - Tears of the Vale [mRtKmFknE0o].40.jpg&quot; -vf &quot;crop=870:720:205:0&quot; cover_crop.jpg 
  </code></pre>
  <p>This leaves behind an output_image.jpg with 870x720 dimensions, still too large to use for the normal size .mkv cover art.  We could have just cropped the input file down to a square 600x600 and be done with it, like so:</p>
  <pre><code>&quot;C:\Path_To_FFMPEG\ffmpeg.exe&quot; -i input_image.jpg -vf  &quot;crop=out_w=600:out_h=600&quot; cover.jpg
  </code></pre>
  <p>That just cuts out the center of the input image by default, like a cookie cutter.  That might be &quot;good enough&quot; in some cases, but in this case it leaves an ugly art result, so we choose to follow the cropping-off of black bars with a scaling down from 870x720 to some_new_scaled_down_widthx600 instead:</p>
  <pre><code>ffmpeg -i cover_crop.jpg -vf scale=&quot;-1:600&quot; cover.jpg
  </code></pre>
  <p>The actual command I applied to do this in my specific case is:</p>
  <pre><code>&quot;C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe&quot; -i &quot;C:\yt-dlp\The Old Ways\cover_crop.jpg&quot; -vf scale=&quot;-1:600&quot; cover.jpg
  </code></pre>
  <p>In the end, I made a batch file to handle adding both normal &amp; small thumbnails to 25 videos at once.  I moved the index number &quot;<em>(filename_is_YouTube_video_title)</em>.40.jpg&quot; thumbnails I got from the --write-all-thumbs of yt-dlp into a folder called &quot;C:\yt-dlp\The Old Ways\Fast_Cover&quot;, and the matching .mkv files, &quot;<em>(filename_is_YouTube_video_title)</em>.mkv&quot; are sitting in a folder named &quot;C:\yt-dlp\The Old Ways\temp&quot;.  Here's the batch file I used on Windows 10 to generate &amp; combine the normal &amp; small landscape orientation thumbnails to each video.  I open a command prompt window at the &quot;Fast_Cover&quot; working directory, and run this batch file from that folder:</p>
  <pre><code>chcp 65001 &gt;NUL
  @ECHO OFF
  TITLE Add Cover Thumbnails To .mkv Files
  
  SETLOCAL EnableExtensions EnableDelayedExpansion
  
  set /a count=0
  
  for %%A IN (&quot;C:\yt-dlp\The Old Ways\temp\*.mkv&quot;) DO (
   set filename=%%~nA
   set extension=%%~xA
   set /a count+=1
   echo Loop #:!count!
   set &quot;output[!count!]=!filename!&quot;
  )
  
  For /L %%i in (1,1,%count%) Do (
   Call :Action &quot;!output[%%i]!&quot;
  )
  
  REM DEL &quot;*.jpg&quot;
  
  exit /b 0
  
  ::*******************************************************
  :Action
  
  echo ACTION:%~1
  
  &quot;C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe&quot; -y -i &quot;%~1.40.jpg&quot; -vf scale=&quot;-1:600&quot; cover_land.jpg
  &quot;C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe&quot; -y -i &quot;%~1.40.jpg&quot; -vf scale=&quot;-1:120&quot; small_cover_land.jpg
  
  &quot;C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe&quot; -y ^
  -i &quot;C:\yt-dlp\The Old Ways\temp\%~1.mkv&quot; ^
  -attach &quot;cover_land.jpg&quot; ^
  -attach &quot;small_cover_land.jpg&quot; ^
  -map 0 ^
  -c copy ^
  -metadata:s:t mimetype=image/jpg ^
  -metadata:s:t:0 filename=cover_land.jpg ^
  -metadata:s:t:0 filename=small_cover_land.jpg ^
  &quot;%~1.mkv&quot; 
  
  exit /b 0
  ::*******************************************************
  </code></pre>
  <p>The very 1st line, &quot;chcp 65001 &gt;NUL&quot; is there to help the batch file handle Unicode characters that show up all of the time in YouTube video titles.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-21T23:22:36.723Z
Answers.LastActivityDate: 2024-11-21T23:22:36.723Z
Answers.UserDisplayName: Ace Frahm
Body: <p>I am trying to embed a thumbnail in a <code>.mkv</code> file with <code>h265</code> video encoding using <code>ffmpeg</code> from the Linux command line. I am able to embed thumbnails in <code>h264</code>-encoded <code>.mp4</code> files using the following command:</p>
  <pre><code>ffmpeg -i video-in.mp4 -i thumb.png -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic out.mp4
  </code></pre>
  <p>However, a similar command substituting <code>.mkv</code> files does not correctly embed the thumbnail:</p>
  <pre><code>ffmpeg -i video-in.mkv -i thumb.png -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic out.mkv
  </code></pre>
  <p><code>ffmpeg</code> will run just fine, throwing no warnings or errors, but the thumbnail that shows in Dolphin after it's run its course is a generic auto-generated thumbnail instead of the one I specified with <code>-i thumb.png</code>.</p>
  <p>I first learned how to do this while reading the <code>ffmpeg</code> documentation <a href="https://ffmpeg.org/ffmpeg.html#Main-options" rel="noreferrer">here</a> (a bit further down, where it explains dispositions). I noticed that it says &quot;Not all muxers support embedded thumbnails, and those who do, only support a few formats, like JPEG or PNG.&quot; This makes me think that maybe the matroska/mkv muxer simply doesn't support embedded thumbnails. However, further research has me confused.</p>
  <p>The <a href="https://ffmpeg.org/ffmpeg-formats.html" rel="noreferrer">ffmpeg Formats documentation</a> doesn't list thumbnail(s) as an option in the metadata section of <a href="https://ffmpeg.org/ffmpeg-formats.html#matroska" rel="noreferrer">the matroska muxer docs</a>, which further supports the theory that embedding is impossible. I figured I'd double-check that thumbnails are listed as an option for mp4s just to be sure. However, the <a href="https://ffmpeg.org/ffmpeg-formats.html#mov_002c-mp4_002c-ismv" rel="noreferrer">mov/mp4/ismv muxer section</a> doesn't even <em>have</em> a Metadata sub-section.</p>
  <p>The <a href="https://docs.fileformat.com/video/mp4/" rel="noreferrer">MP4 File Format Documentation</a> I've been able to find isn't very helpful. I can't tell whether thumbnail embedding is possible based on this documentation alone (though obviously I know from experience that it's possible).</p>
  <p>The <a href="https://docs.fileformat.com/video/mkv/" rel="noreferrer">MKV Container Documentation</a> is a lot more thorough, though, and it says in the first section <a href="https://docs.fileformat.com/video/mkv/#what-is-an-mkv-file" rel="noreferrer">(&quot;What is an MKV File?&quot;)</a> that &quot;MKV also supports descriptions, ratings, <em><strong>cover art</strong></em>, and even chapter points&quot; (emphasis mine). In the <a href="https://docs.fileformat.com/video/mkv/#matroska-structure" rel="noreferrer">&quot;Matroska Structure&quot;</a> section it also lists &quot;Attachments&quot; as one of the top-level elements of the container structure. All of this leads me to believe that embedded thumbnails <em>are in fact</em> possible with .mkv files.</p>
  <p>So, to summarize: on the one hand, <code>ffmpeg</code>'s documentation makes me think I can't embed thumbnails in <code>.mkv</code> files. But the MKV file format documentation makes me think I <em>should</em> be able to. I haven't been able to figure out for sure either way, though, and even if it is possible, the method for doing so differs from the method I use for <code>.mp4</code> files.</p>
  <p>Is it possible to embed thumbnails in <code>.mkv</code> files? If so, how would I do it (preferably using <code>ffmpeg</code> on Linux)?</p>
  
Tags: <ffmpeg><linux><mkv><thumbnails><embedding>
Title: Is it possible to embed a thumbnail in a .mkv file?
UserDisplayName: HunterThueson
ThreadText: # Is it possible to embed a thumbnail in a .mkv file?
  
  (Asked by: username_0 on 2022-08-16)
  
  I am trying to embed a thumbnail in a `.mkv` file with `h265` video encoding using `ffmpeg` from the Linux command line. I am able to embed thumbnails in `h264`-encoded `.mp4` files using the following command:
  
  ```
  ffmpeg -i video-in.mp4 -i thumb.png -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic out.mp4
  
  ```
  
  However, a similar command substituting `.mkv` files does not correctly embed the thumbnail:
  
  ```
  ffmpeg -i video-in.mkv -i thumb.png -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic out.mkv
  
  ```
  
  `ffmpeg` will run just fine, throwing no warnings or errors, but the thumbnail that shows in Dolphin after it's run its course is a generic auto-generated thumbnail instead of the one I specified with `-i thumb.png`.
  
  I first learned how to do this while reading the `ffmpeg` documentation [here](https://ffmpeg.org/ffmpeg.html#Main-options) (a bit further down, where it explains dispositions). I noticed that it says "Not all muxers support embedded thumbnails, and those who do, only support a few formats, like JPEG or PNG." This makes me think that maybe the matroska/mkv muxer simply doesn't support embedded thumbnails. However, further research has me confused.
  
  The [ffmpeg Formats documentation](https://ffmpeg.org/ffmpeg-formats.html) doesn't list thumbnail(s) as an option in the metadata section of [the matroska muxer docs](https://ffmpeg.org/ffmpeg-formats.html#matroska), which further supports the theory that embedding is impossible. I figured I'd double-check that thumbnails are listed as an option for mp4s just to be sure. However, the [mov/mp4/ismv muxer section](https://ffmpeg.org/ffmpeg-formats.html#mov_002c-mp4_002c-ismv) doesn't even *have* a Metadata sub-section.
  
  The [MP4 File Format Documentation](https://docs.fileformat.com/video/mp4/) I've been able to find isn't very helpful. I can't tell whether thumbnail embedding is possible based on this documentation alone (though obviously I know from experience that it's possible).
  
  The [MKV Container Documentation](https://docs.fileformat.com/video/mkv/) is a lot more thorough, though, and it says in the first section [("What is an MKV File?")](https://docs.fileformat.com/video/mkv/#what-is-an-mkv-file) that "MKV also supports descriptions, ratings, ***cover art***, and even chapter points" (emphasis mine). In the ["Matroska Structure"](https://docs.fileformat.com/video/mkv/#matroska-structure) section it also lists "Attachments" as one of the top-level elements of the container structure. All of this leads me to believe that embedded thumbnails *are in fact* possible with .mkv files.
  
  So, to summarize: on the one hand, `ffmpeg`'s documentation makes me think I can't embed thumbnails in `.mkv` files. But the MKV file format documentation makes me think I *should* be able to. I haven't been able to figure out for sure either way, though, and even if it is possible, the method for doing so differs from the method I use for `.mp4` files.
  
  Is it possible to embed thumbnails in `.mkv` files? If so, how would I do it (preferably using `ffmpeg` on Linux)?
  
  **Tags:** ffmpeg, linux, mkv, thumbnails, embedding
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-11-23. Score: 2
  
  I was also going down this rabbit hole and found that there's an option `-attach filename` that's more specific to `mkv` files. It's at the end of the "Main Options" section of the manual: <https://ffmpeg.org/ffmpeg.html#Main-options>
  
  ```
  ffmpeg -i video.mkv -attach cover.jpg -metadata:s:t:0 mimetype=image/jpeg -c copy out.mkv
  
  ```
  
  The `-metadata:s:t:0` specifically selects the first attachment stream (which should be just the cover photo).
  
  > **Comments:**
  > **username_2**: This works but I still would like to remind that **the thumbnail image must have "cover" as its file name**, such as "cover.jpg" or "cover.png". If we use file names like "thumb.png", FFmpeg won't report an error, but the thumbnail also won't display properly on the MKV output.  
  > **username_3**: How to do this in Windows, it doesn't work for me in Windows 11...  
  > **username_4**: @username_3 Windows seems to not read MKV cover art. I use third-party software like Icaros to replace Windows built-in thumbnail provider. (But Windows can read MP3 and MP4 cover art...)  
  > **username_3**: @username_4 I noticed, when I open the movie in VLC media player and press CTRL + I I can actually see the thumbnail, but it doesn't show on File Explorer https://i.imgur.com/qbStjay.jpeg  
  > **username_4**: @username_3 Based on the software I think, PotPlayer cannot display the embedded thumbnail.  
  
  ---
  
  ### Answer by username_5 on 2024-11-21. Score: 0
  
  It turns out that the Matroska format also demands that the image ( ONLY a .jpg or a .png can be used ) must not only be named "cover.jpg" or "cover.png"; there is an obscure ADDITIONAL REQUIREMENT that the cover image's smallest dimension ( width or height ) MUST BE NO LARGER THAN 600 PIXELS!
  The relevant Matroska specification is here:
  <https://www.matroska.org/technical/attachments.html> Here's a back-up copy of the same page of the spec at the Internet Archive's Wayback Machine:
  <https://web.archive.org/web/20240918125616/https://www.matroska.org/technical/attachments.html>
  
  Read the specification closely! If your cover image file has a square or portrait mode orientation, you can simply use the "cover.ext" naming convention for the file.
  BUT if your cover image file has a LANDSCAPE mode orientation, the Matroska spec says you *SHOULD* use the suffix "\_land" on the filename(!!!), like this: "cover\_land.ext" ( "cover\_land.jpg" or "cover\_land.png", depending upon your filetype ).
  
  AND... The Matroska spec ALSO says you may include 1 smaller thumbnail image if you want to, with a shortest dimension no greater than 120 pixels! The normal size cover image must be the 1st attachment, though, and the smaller thumbnail is required to follow a "small\_" prefix naming convention: "small\_cover.ext" or "small\_cover\_land.ext"
  
  Resize an image with ffmpeg
  To retain aspect ratio:
  
  ```
  ffmpeg -i art_image_for_use_as_cover.jpg -vf scale="-1:600" cover.jpg
  
  ```
  
  or if you want to resize based on input width and height, where '2' is used in both dimensions here to shrink them down by 1/2
  
  ```
  ffmpeg -i input_art_image.png -vf scale="iw/2:ih/2" cover.png
  
  ```
  
  where ( this happens automatically, you don't need to replace "iw" or "ih" in that command )
  
  * iw: input width
  * ih: input height
  
  Here's where the FFMPEG manual describes "scaling" and the parameters you can use:
  <https://ffmpeg.org/ffmpeg-filters.html#scale-1>
  
  If by some chance you're also [using YT-DLP to get videos from YouTube](https://github.com/yt-dlp/yt-dlp), you can command yt-dlp to grab the images of various sizes that it uses for a particular video with this --write-all-thumb command option:
  
  ```
  "C:\yt-dlp\yt-dlp.exe" --skip-download --write-all-thumb https://www.youtube.com/watch?v=mRtKmFknE0o
  
  ```
  
  The --skip-download option will prevent yt-dlp from downloading the actual video file, but --write-all-thumb will give you the entire set of thumbnails for that video in various sizes, in both .jpg and .webp formats, sequentially numbered from smallest to largest. There is currently ( in 2024 ) no method to retrieve just 1 specific size, you have to download the entire set ( about 42 images ) and then just delete the ones you don't need.
  
  It turns out that for this given example video, none of the widths or heights is exactly 600 pixels. And the thumbnails of the art for this example video has black bars to the left & right, which are ugly & unnecessary, so we can simply crop them off. I pick the thumbnail .jpg index numbered at 40, since that is first index of the largest size .jpg thumbnail returned, I presume it will have the most detail:
  
  ```
  "The Old Ways Podcast - Six Seasons in Sartar - Episode 22 - Tears of the Vale [mRtKmFknE0o].40.jpg"
  
  ```
  
  A higher index number, 43, also exists, but it has the same file size & image width & height, so I presume it is no different than #40.
  
  What the FFMPEG manual has to say about using it to crop still images & video:
  
  <https://ffmpeg.org/ffmpeg-filters.html#crop>
  
  So to crop the black bars ( which are 280 pixels wide ) off of the #40 thumbnail of this example:
  
  ```
  "C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe" -i "The Old Ways Podcast - Six Seasons in Sartar - Episode 22 - Tears of the Vale [mRtKmFknE0o].40.jpg" -vf "crop=720:720:280:0" cover_crop.jpg
  
  ```
  
  I see that I cut off too much of the left & right sides of the art, discovering my initial guess that the art width was 720 pixels wide was off. Using Photoshop, I see the image is 1280 wide & 720 pixels tall. when I use the crop tool by hand to chop off the black bars, it becomes 869 pixels wide... I did that by hand so I just round that off to nearest ten, 870 pixels wide... Then 1280 - 870 = 410 total width of black pixels were cropped out from left & right, so to get the starting x position value of a proper crop with FFMPEG, we divide that by 2: 410 / 2 = 205... **It only makes sense to go to this trouble, to expend this effort, if we plan to use a batch file to crop, scale & add thumbnails to LOTS of videos at once, or many, many times in the future!**
  
  The cropping command looks like this, generically:
  
  ```
  "C:\Path_To_FFMPEG\ffmpeg.exe" -i input_image.jpg -vf "crop=720:720:280:0" output_image.jpg 
  
  ```
  
  Cropping in my specific example case:
  
  ```
  "C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe" -i "The Old Ways Podcast - Six Seasons in Sartar - Episode 22 - Tears of the Vale [mRtKmFknE0o].40.jpg" -vf "crop=870:720:205:0" cover_crop.jpg 
  
  ```
  
  This leaves behind an output\_image.jpg with 870x720 dimensions, still too large to use for the normal size .mkv cover art. We could have just cropped the input file down to a square 600x600 and be done with it, like so:
  
  ```
  "C:\Path_To_FFMPEG\ffmpeg.exe" -i input_image.jpg -vf  "crop=out_w=600:out_h=600" cover.jpg
  
  ```
  
  That just cuts out the center of the input image by default, like a cookie cutter. That might be "good enough" in some cases, but in this case it leaves an ugly art result, so we choose to follow the cropping-off of black bars with a scaling down from 870x720 to some\_new\_scaled\_down\_widthx600 instead:
  
  ```
  ffmpeg -i cover_crop.jpg -vf scale="-1:600" cover.jpg
  
  ```
  
  The actual command I applied to do this in my specific case is:
  
  ```
  "C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe" -i "C:\yt-dlp\The Old Ways\cover_crop.jpg" -vf scale="-1:600" cover.jpg
  
  ```
  
  In the end, I made a batch file to handle adding both normal & small thumbnails to 25 videos at once. I moved the index number "*(filename\_is\_YouTube\_video\_title)*.40.jpg" thumbnails I got from the --write-all-thumbs of yt-dlp into a folder called "C:\yt-dlp\The Old Ways\Fast\_Cover", and the matching .mkv files, "*(filename\_is\_YouTube\_video\_title)*.mkv" are sitting in a folder named "C:\yt-dlp\The Old Ways\temp". Here's the batch file I used on Windows 10 to generate & combine the normal & small landscape orientation thumbnails to each video. I open a command prompt window at the "Fast\_Cover" working directory, and run this batch file from that folder:
  
  ```
  chcp 65001 >NUL
  @ECHO OFF
  TITLE Add Cover Thumbnails To .mkv Files
  
  SETLOCAL EnableExtensions EnableDelayedExpansion
  
  set /a count=0
  
  for %%A IN ("C:\yt-dlp\The Old Ways\temp\*.mkv") DO (
   set filename=%%~nA
   set extension=%%~xA
   set /a count+=1
   echo Loop #:!count!
   set "output[!count!]=!filename!"
  )
  
  For /L %%i in (1,1,%count%) Do (
   Call :Action "!output[%%i]!"
  )
  
  REM DEL "*.jpg"
  
  exit /b 0
  
  ::*******************************************************
  :Action
  
  echo ACTION:%~1
  
  "C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe" -y -i "%~1.40.jpg" -vf scale="-1:600" cover_land.jpg
  "C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe" -y -i "%~1.40.jpg" -vf scale="-1:120" small_cover_land.jpg
  
  "C:\Program Files\FFMPEG For YT-DLP\ffmpeg.exe" -y ^
  -i "C:\yt-dlp\The Old Ways\temp\%~1.mkv" ^
  -attach "cover_land.jpg" ^
  -attach "small_cover_land.jpg" ^
  -map 0 ^
  -c copy ^
  -metadata:s:t mimetype=image/jpg ^
  -metadata:s:t:0 filename=cover_land.jpg ^
  -metadata:s:t:0 filename=small_cover_land.jpg ^
  "%~1.mkv" 
  
  exit /b 0
  ::*******************************************************
  
  ```
  
  The very 1st line, "chcp 65001 >NUL" is there to help the batch file handle Unicode characters that show up all of the time in YouTube video titles.
  
  
  ---
  
  