I am encoding a video with ffmpeg into H.264 stored in an FLV container. I would like to be able to trim segments of this video out as it is still encoding. The video contains no audio.

I am encoding the video like so:

ffmpeg -i recording.mp4 -c libx264 output.flv

And I'm attempting to trim the video with:

ffmpeg -i output.flv -ss 00:00:00.000 -t 00:00:01.000 -c copy output2.mp4

While the video is still encoding, I see this error when I try to trim:

Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

Also while encoding, using ffprobe, I get information like the following:

Duration: 00:00:26.96, start: 0.080000, bitrate: 126 kb/s
  Stream #0:0: Video: h264 (High), yuv420p, 640x480, 25 fps, 25 tbr, 1k tbn, 50 tbc

How can I go about trimming this file while it's still encoding? I am willing to change container formats from flv to something else if needed. Ultimately, I need to be in mp4, but I don't mind doing some container shuffling to allow me to trim out portions while still encoding.

  • Works here. Which ffmpeg version?
    – Gyan
    May 22, 2018 at 19:59
  • 2.8.14. From the official Ubuntu 16.04 repos
    – seanr8
    May 22, 2018 at 20:02
  • Get a binary from johnvansickle.com/ffmpeg and check.
    – Gyan
    May 22, 2018 at 20:04
  • I just did. However, now it trims without error, but the resulting file has a length of 0 and 0 frames are in it. I used the exact same command as above, but used the build you linked to. I tried both the release and the git builds. Are you using a publicly available sample video I could find somewhere and try myself?
    – seanr8
    May 22, 2018 at 20:13
  • Do you get the same behaviour if you cut a longer segment?
    – timonsku
    May 22, 2018 at 21:22

1 Answer 1


Keep FLV but trim using demuxer seek and duration.

ffmpeg -ss 00:00:03.000 -t 00:00:01.000 -i output.flv -c copy output2.mp4

Also, skip -ss if it's 0 i.e. stream start.

  • Skipping -ss for the start is what fixed it for me. It seems like the file was really starting at 0.080. How would I know that if I were writing a script to trim a file?
    – seanr8
    May 23, 2018 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.