user4213: I need to trim videos with a precise end frame, however, ffmpeg seems to cut the video at the nearest first key-frame. So I don't have enough control over the ending frame.
I try to insert key-frame before trimming, but it doesn't work.
These are my command lines:
ffmpeg -i <sVideoFilename> -force_key_frames 00:00:1:520 -vcodec wmv1 -acodec wmav2 -q:a 0 -q:v 0 <sVideoFilenamekf>

ffmpeg -i <sVideoFilenamekf> -ss 00:00:1:520 -to 00:00:3:640 -vcodec wmv1 -acodec wmav2 -q:v 0 -q:a 10 -r 30 <sVideoFilenameTrimmed>*

What's wrong with my command line ?
Thanks for your answer

user2836: You seem to have a fundamental misunderstanding of how video works.  Video is composed of frames.  You can't have millisecond precision because video doesn't have millisecond precision.  If there are 30 frames per second in the video, you can only stop after one of those frames.  That means your options are only every 1/30th of a second roughly.
If the format is group of pictures based it may be limited when it can end as well depending on the formats ability to end a group of pictures early. (A group of pictures is used in formats where some frames are stored as changes from other related frames rather than full images.)
What are you trying to accomplish that you need this precision for?  Perhaps there may be an alternate way to accomplish your goal.

4213: <p>I need to trim videos with a precise end frame, however, <code>ffmpeg</code> seems to cut the video at the nearest first key-frame. So I don't have enough control over the ending frame.
I try to insert key-frame before trimming, but it doesn't work.
These are my command lines:</p>

<pre><code>ffmpeg -i &lt;sVideoFilename&gt; -force_key_frames 00:00:1:520 -vcodec wmv1 -acodec wmav2 -q:a 0 -q:v 0 &lt;sVideoFilenamekf&gt;

ffmpeg -i &lt;sVideoFilenamekf&gt; -ss 00:00:1:520 -to 00:00:3:640 -vcodec wmv1 -acodec wmav2 -q:v 0 -q:a 10 -r 30 &lt;sVideoFilenameTrimmed&gt;*
</code></pre>

<p>What's wrong with my command line ?
Thanks for your answer</p>
 2836: <p>You seem to have a fundamental misunderstanding of how video works.  Video is composed of frames.  You can't have millisecond precision because video doesn't have millisecond precision.  If there are 30 frames per second in the video, you can only stop after one of those frames.  That means your options are only every 1/30th of a second roughly.
If the format is group of pictures based it may be limited when it can end as well depending on the formats ability to end a group of pictures early. (A group of pictures is used in formats where some frames are stored as changes from other related frames rather than full images.)</p>

<p>What are you trying to accomplish that you need this precision for?  Perhaps there may be an alternate way to accomplish your goal.</p>
