user14486: i'm using this command to cut a segment from a video from command line
ffmpeg -i %1 -vcodec copy -acodec copy -ss %2 -t %3 %~n1_cut%~x1

and i call it like
cut.bat video.mp4 001:23:45:678 10

and as expected i get a video_cut.mp4 with 10 seconds of the original video, problem is that few seconds of the resulting file is black screen with audio, why does this happen and how do i fix it?

user24088: https://github.com/mifi/lossless-cut/pull/13
When I run ffmpeg with the arguments in this order -i ... -ss ... -t ..., it produces a video file that has no video for a few initial seconds. (as far as I can understand this is because it doesn't seek to a keyframe?)
If I change the order to -ss ... -i ... -t ..., then the resulting cut videos play properly.
My ffmpeg -version

user1871: Most videos use codecs which perform temporal compression, so a specified cutpoint may rely on frames before (and after) that cutpoint to be correctly decoded. So, when you use ffmpeg to trim videos and use copy mode, ffmpeg has to include all frames before and after the trimmed segment which are needed to decode the segment correctly.
So, you have two options, use copy mode but set a switch which will allow all players to correctly play these files
ffmpeg -ss %2 -t %3 -i %1 -vcodec copy -acodec copy -avoid_negative_ts make_zero %~n1_cut%~x1

(this will likely result in output that starts before your cutpoint)
or re-encode the streams
ffmpeg -ss %2 -t %3 -i %1 %~n1_cut%~x1


14486: <p>i'm using this command to cut a segment from a video from command line</p>

<pre><code>ffmpeg -i %1 -vcodec copy -acodec copy -ss %2 -t %3 %~n1_cut%~x1
</code></pre>

<p>and i call it like</p>

<pre><code>cut.bat video.mp4 001:23:45:678 10
</code></pre>

<p>and as expected i get a video_cut.mp4 with 10 seconds of the original video, problem is that few seconds of the resulting file is black screen with audio, why does this happen and how do i fix it?</p>
 24088: <p><a href="https://github.com/mifi/lossless-cut/pull/13" rel="noreferrer">https://github.com/mifi/lossless-cut/pull/13</a></p>

<p>When I run ffmpeg with the arguments in this order -i ... -ss ... -t ..., it produces a video file that has no video for a few initial seconds. (as far as I can understand this is because it doesn't seek to a keyframe?)</p>

<p>If I change the order to -ss ... -i ... -t ..., then the resulting cut videos play properly.</p>

<p>My <code>ffmpeg -version</code></p>
 1871: <p>Most videos use codecs which perform temporal compression, so a specified cutpoint may rely on frames before (and after) that cutpoint to be correctly decoded. So, when you use ffmpeg to trim videos and use <code>copy</code> mode, ffmpeg has to include all frames before and after the trimmed segment which are needed to decode the segment correctly.</p>

<p>So, you have two options, use copy mode but set a switch which will allow all players to correctly play these files</p>

<pre><code>ffmpeg -ss %2 -t %3 -i %1 -vcodec copy -acodec copy -avoid_negative_ts make_zero %~n1_cut%~x1
</code></pre>

<p>(this will likely result in output that starts before your cutpoint)</p>

<p>or re-encode the streams</p>

<pre><code>ffmpeg -ss %2 -t %3 -i %1 %~n1_cut%~x1
</code></pre>
