1

I can split an aid (or video) file by time, but how do I split it by file size?

ffmpeg -i input.mp3 -ss S -to E -c copy output1.mp3 -ss S -to E -c copy output2.mp3

Which is fine if I have time codes, but if I want the output files to be split at 256MB regardless of the time length, what do I do? (What I am doing now is estimating, but that often means I have to make multiple runs at it with -ss S -to E to get files that are close to where I want in size).

4
  • 2
  • wow. searched for ffmpeg file size and that di not come up. So, not possible in ffmpeg itself, but possible with a wrapper script. That will work, was hoping to avoid that, but it will work. (well, the script does not work with current ffmpeg, but is probably fixable)
    – lbutlr
    Nov 8, 2020 at 16:54
  • Do you want the pieces to be valid mp3 files? If not, the split command will do this for you. Jun 20, 2021 at 0:19
  • Does it have to be ffmpeg? If not, also have a look at mp3splt, which (a) does not re-encode and (b) has better splitting options, though I haven't seen a "file size" method. And if your mp3 has constant bitrate, a 256MB should have a given number of frames, so you can split on number of frames, or time length.
    – dirkt
    Jun 20, 2021 at 5:08

1 Answer 1

1

The option you are looking for is -fs which limits the file size.

here is the official documentation: https://ffmpeg.org/ffmpeg.html#Main-options

1
  • pleace tell me the whole command which i should type.
    – radiorz
    Nov 25, 2021 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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