File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -307,6 +307,7 @@ static av_cold int init_subtitles(AVFilterContext *ctx)
307307 AVStream * st ;
308308 AVPacket pkt ;
309309 AssContext * ass = ctx -> priv ;
310+ int64_t timestamp ;
310311
311312 /* Init libass */
312313 ret = init (ctx );
@@ -445,6 +446,16 @@ static av_cold int init_subtitles(AVFilterContext *ctx)
445446 ass_process_codec_private (ass -> track ,
446447 dec_ctx -> subtitle_header ,
447448 dec_ctx -> subtitle_header_size );
449+
450+ /* Skip the parts that won’t be used anyway */
451+ timestamp = av_rescale (ass -> start_time , st -> time_base .den ,
452+ AV_TIME_BASE * (int64_t ) st -> time_base .num );
453+ ret = av_seek_frame (fmt , sid , timestamp , 0 );
454+ if (ret < 0 ) {
455+ av_log (ctx , AV_LOG_WARNING , "Error seeking: %s (ignored)\n" ,
456+ av_err2str (ret ));
457+ }
458+
448459 av_init_packet (& pkt );
449460 pkt .data = NULL ;
450461 pkt .size = 0 ;
You can’t perform that action at this time.
0 commit comments