user36875: I have a 30-fps video just downloaded by youtube-dl, and it seems to have black frames in the beginning of it.
Part of the result of ffprobe youtube-dl.mp4:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'youtube-dl.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.43.100
  Duration: 00:04:53.69, start: 0.000000, bitrate: 1250 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1115 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.

Then I tried to trim the video using ffmpeg -i youtube-dl.mp4 -ss 0:0:0 -to 0:4:37 -vcodec copy -acodec copy youtube-dl-trimmed.mp4. Part of the result is below:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'youtube-dl.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.43.100
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1115 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
Output #0, mp4, to 'youtube-dl-trimmed.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.43.100
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1115 kb/s, 30 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 8288 fps=0.0 q=-1.0 Lsize=   43944kB time=00:04:36.99 bitrate=1299.6kbits/s speed= 382x
video:39364kB audio:4329kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.575328%

And use ffprobe to probe it:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'youtube-dl-trimmed.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.43.100
  Duration: 00:04:37.02, start: 0.000000, bitrate: 1299 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1167 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.

What I wonder is that the playback results of some applications and video processing libraries vary. In some of them the video still remains the black frames, but in the others the first 22 frames disappear and certainly the total number of frames is decreased. The test result about the black frames is below:




Applications or Libraries
youtube-dl.mp4
youtube-dl-trimmed.mp4




ffplay
remained
disappeared


PotPlayer
remained
remained


VLC Player
remained
remained


Aegisub
remained
disappeared


Adobe Premiere
remained
remained


OpenCV library
remained
disappeared




It bothers me a lot because I use Aegisub to create ASS subtitles but I use FFmpeg to burn a subtitle into youtube-dl-trimmed.mp4, the black frames remain and thus the showing time of every line isn't fit with the speakers' words. Also the black frames still here when using ffplay to play the hard-subtitled video. What's wrong with these videos? Does youtube-dl-trimmed.mp4 have dropped frames? Any reply is appreciated.

EDIT:
Version string and configuration options of my ffmpeg:
ffmpeg version git-2020-05-15-b18fd2b Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200513
configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libdav1d --enable-libbluray --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora
--enable-libtwolame --enable-libvpx --enable-libwavpack
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2
--enable-libzimg --enable-lzma --enable-zlib --enable-gmp
--enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc
--enable-libmysofa --enable-libspeex --enable-libxvid
--enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec
--enable-cuda-llvm --enable-cuvid --enable-d3d11va
--enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
--enable-libopenmpt --enable-amf
libavutil      56. 45.100 / 56. 45.100
libavcodec     58. 84.100 / 58. 84.100
libavformat    58. 43.100 / 58. 43.100
libavdevice    58.  9.103 / 58.  9.103
libavfilter     7. 81.100 /  7. 81.100
libswscale      5.  6.101 /  5.  6.101
libswresample   3.  6.100 /  3.  6.100
libpostproc    55.  6.100 / 55.  6.100


EDIT 2:
@slhck provided a workaround in the comments. Re-encoding the video can  keep all players behaving well.

user525: To get the correct behavior on all players, you have to re-encode the video, i.e. remove the -c:v copy/-vcodec copy part and replace it with, for example:
-c:v libx264 -crf 23

Pair it with a positive specification for -ss, e.g. -ss 0.2, to get rid of whatever black frames there were in the beginning.
This will ensure that all frames get re-encoded.

36875: <p>I have a 30-fps video just downloaded by <code>youtube-dl</code>, and it seems to have black frames in the beginning of it.</p>
<p>Part of the result of <code>ffprobe youtube-dl.mp4</code>:</p>
<pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'youtube-dl.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.43.100
  Duration: 00:04:53.69, start: 0.000000, bitrate: 1250 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1115 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
</code></pre>
<p>Then I tried to trim the video using <code>ffmpeg -i youtube-dl.mp4 -ss 0:0:0 -to 0:4:37 -vcodec copy -acodec copy youtube-dl-trimmed.mp4</code>. Part of the result is below:</p>
<pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'youtube-dl.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.43.100
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1115 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
Output #0, mp4, to 'youtube-dl-trimmed.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.43.100
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1115 kb/s, 30 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
Stream mapping:
  Stream #0:0 -&gt; #0:0 (copy)
  Stream #0:1 -&gt; #0:1 (copy)
Press [q] to stop, [?] for help
frame= 8288 fps=0.0 q=-1.0 Lsize=   43944kB time=00:04:36.99 bitrate=1299.6kbits/s speed= 382x
video:39364kB audio:4329kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.575328%
</code></pre>
<p>And use <code>ffprobe</code> to probe it:</p>
<pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'youtube-dl-trimmed.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.43.100
  Duration: 00:04:37.02, start: 0.000000, bitrate: 1299 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1167 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
</code></pre>
<p>What I wonder is that the playback results of some applications and video processing libraries vary. In some of them the video still remains the black frames, but in the others the first 22 frames disappear and certainly the total number of frames is decreased. The test result about the black frames is below:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: center;">Applications or Libraries</th>
<th style="text-align: center;">youtube-dl.mp4</th>
<th style="text-align: center;">youtube-dl-trimmed.mp4</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;">ffplay</td>
<td style="text-align: center;">remained</td>
<td style="text-align: center;">disappeared</td>
</tr>
<tr>
<td style="text-align: center;">PotPlayer</td>
<td style="text-align: center;">remained</td>
<td style="text-align: center;">remained</td>
</tr>
<tr>
<td style="text-align: center;">VLC Player</td>
<td style="text-align: center;">remained</td>
<td style="text-align: center;">remained</td>
</tr>
<tr>
<td style="text-align: center;">Aegisub</td>
<td style="text-align: center;">remained</td>
<td style="text-align: center;">disappeared</td>
</tr>
<tr>
<td style="text-align: center;">Adobe Premiere</td>
<td style="text-align: center;">remained</td>
<td style="text-align: center;">remained</td>
</tr>
<tr>
<td style="text-align: center;">OpenCV library</td>
<td style="text-align: center;">remained</td>
<td style="text-align: center;">disappeared</td>
</tr>
</tbody>
</table>
</div>
<p>It bothers me a lot because I use Aegisub to create ASS subtitles but I use FFmpeg to burn a subtitle into <code>youtube-dl-trimmed.mp4</code>, the black frames remain and thus the showing time of every line isn't fit with the speakers' words. Also the black frames still here when using <code>ffplay</code> to play the hard-subtitled video. What's wrong with these videos? Does <code>youtube-dl-trimmed.mp4</code> have dropped frames? Any reply is appreciated.</p>
<hr />
<p><strong>EDIT:</strong></p>
<p>Version string and configuration options of my <code>ffmpeg</code>:</p>
<pre><code>ffmpeg version git-2020-05-15-b18fd2b Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200513
configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libdav1d --enable-libbluray --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora
--enable-libtwolame --enable-libvpx --enable-libwavpack
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2
--enable-libzimg --enable-lzma --enable-zlib --enable-gmp
--enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc
--enable-libmysofa --enable-libspeex --enable-libxvid
--enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec
--enable-cuda-llvm --enable-cuvid --enable-d3d11va
--enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
--enable-libopenmpt --enable-amf
libavutil      56. 45.100 / 56. 45.100
libavcodec     58. 84.100 / 58. 84.100
libavformat    58. 43.100 / 58. 43.100
libavdevice    58.  9.103 / 58.  9.103
libavfilter     7. 81.100 /  7. 81.100
libswscale      5.  6.101 /  5.  6.101
libswresample   3.  6.100 /  3.  6.100
libpostproc    55.  6.100 / 55.  6.100
</code></pre>
<hr />
<p><strong>EDIT 2:</strong></p>
<p>@slhck provided a workaround in the comments. Re-encoding the video can  keep all players behaving well.</p>
 525: <p>To get the correct behavior on all players, you have to re-encode the video, i.e. remove the <code>-c:v copy</code>/<code>-vcodec copy</code> part and replace it with, for example:</p>
<pre><code>-c:v libx264 -crf 23
</code></pre>
<p>Pair it with a positive specification for <code>-ss</code>, e.g. <code>-ss 0.2</code>, to get rid of whatever black frames there were in the beginning.</p>
<p>This will ensure that all frames get re-encoded.</p>
