3

I'm using ffmpeg to livestream a video file to an RTMP server. I'm using the -re option to ensure the video is streamed at the proper rate to the live source. Occasionally I want to stream the video starting a few minutes in. However, if I add -ss 00:03:00, for example, the first few frames are not streamed, but ffmpeg still goes through them at -re speed, which means I have to wait (in this case) three minutes before the stream can be seen, at which point it starts three minutes in.

This is technically what I asked for, but also useless in context. Is there a way to tell ffmpeg to start at a given time in, but go directly there so that it behaves usefully when using -re?

The ffmpeg-user mailing list has at least two instances of people wondering how to do this with no apparent solution.

1
  • Please show your actual command and the complete console output.
    – llogan
    Apr 19, 2015 at 22:18

1 Answer 1

3

Try specifying -ss 00:03:00 before your input file.

I haven't tried this with screen capture/livestreaming, but I know that this works with standard ffmpeg transcoding syntax.

For example, the following command will input a file, transcode the entire file to h264, and then only save the output starting at the 3 minute mark.

ffmpeg -i [INPUT] -ss 00:03:00 -c:v h264 [output]

On the other hand, the following command, will input a file at the 3 minute mark, transcode from that point, and then save the output. The output file should be identical to the output above, but since the first three minutes aren't being decoded, the processing time is much shorter.

ffmpeg -ss 00:03:00 -i [INPUT] -c:v h264 [output]

Again, I don't know if that works with livestreaming though. Hope it helps!

2
  • Perfect! Now I just have to deal with the fact that the ass filter doesn't notice that the video is being started at a different time, so my subtitles don't match... even so, thanks a ton!
    – Suchipi
    Apr 23, 2015 at 6:01
  • For future readers wondering how to adjust subs, some helpful information lies in FFMPEG Bug #2067. Basically, to offset 00:03:00 as in this example, you would do ffmpeg -ss 180 -i movie.mp4 -vf setpts=PTS+180/TB,ass=subs.ass,setpts=PTS-STARTPTS out.mp4 (and replace ass=subs.ass with subtitles=subs.srt for SRT subtitles).
    – Suchipi
    Apr 23, 2015 at 17:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .