[FFmpeg-user] Tactics for file splitting: Does -fs work when copying?

Stefano Sabatini stefasab at gmail.com
Fri Jan 24 09:49:36 CET 2014

On date Friday 2014-01-24 01:12:04 +0000, Andrew Skretvedt wrote:
> Hello,
> The essence of my question is the subject line, read-on for a full discussion.
> There must be a number of good ways to accomplish this, but one I
> selected didn't work as I expected. I'll explain what I did and
> repliers can suggest alternatives or correct me. The -fs option could
> have a bug, or it may simply be incompletely documented (either case
> should be fixed).
> Scenario: I have a big video file that I need to split into two chunks
> to fit into available media for playback. Precision isn't important.
> The output files may overlap a bit in their content from the original
> video file, but each must be independently playable. I consulted the
> current FFmpeg documentation to help me conjure an appropriate command
> line.
> Today I'm using ffmpeg version N-60106-ge6d1c66, a Zeranoe static
> build for Windows.
> Here's what I tried to create the first chunk, limiting output to
> available storage space:
> ffmpeg -i input.avi -c copy -fs 600MiB output_part1.avi

 -fs limit_size (output)
           Set the file size limit, expressed in bytes.

So you should not multiply the output by 8 (B suffix).

Also see:

> The result was that the -fs option was not respected, and the command
> produced a complete copy of the input instead. Had this worked, my
> second step would've been to take note of the time= display on the
> console output for the and begin the second chunk from approximately
> this time using the -ss option (was that even a sensible approach?).
> As a second try, I instead took a guess as to how much duration of the
> input video would produce about the same limit filesize and issued
> this:
> ffmpeg -i input.avi -c copy -to 01:05:00 output_part1.avi
> This worked as expected, the output was closed at the specified time,
> and I had a file of workable size.
> If the -fs option isn't meant for doing what I'd tried to do above,
> than the current documentation should be revised to point out limiting
> use cases or the scope for which the option may be properly employed.
> Otherwise, this looks like a bit of a bug, and perhaps I should file a
> ticket?

> What if I wanted to divide (copy) an input video into multiple
> independently playable segments? Would options like -ss, -to, and/or
> -fs be the best approach?

For this probably the segment muxer would be a better approach. Adding
some way to select the output size of each segment could be in general
useful (but is currently a missing feature). Note that you can still
create a script to do it, using ffprobe and noting the file position
(packet pos) corresponding to the various (video) packets and
selecting corresponding segment times.

More information about the ffmpeg-user mailing list