]> git.sesse.net Git - ffmpeg/blobdiff - ffmpeg.c
ffmpeg: Fix shortest with libx264
[ffmpeg] / ffmpeg.c
index 36e9c2b23d3b6fe8e446e413783062ffebdf50cf..feff2c4f9eb4a4ab8828660065156bfc8b31bdaa 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -597,9 +597,8 @@ static void close_output_stream(OutputStream *ost)
 
     ost->finished = 1;
     if (of->shortest) {
-        int i;
-        for (i = 0; i < of->ctx->nb_streams; i++)
-            output_streams[of->ost_index + i]->finished = 1;
+        int64_t end = av_rescale_q(ost->sync_opts - ost->first_pts, ost->st->codec->time_base, AV_TIME_BASE_Q);
+        of->recording_time = FFMIN(of->recording_time, end);
     }
 }