[FFmpeg-user] Split a video file in two by size and merge itback

Moritz Barsnick barsnick at gmx.net
Thu Oct 17 13:14:08 EEST 2019


On Thu, Oct 17, 2019 at 03:44:49 +0200, Julien Dotsev wrote:
> Actually every bit. I want to be able to bring back the original file
> unchanged up to every bit. But every chunk playable.

If you want not only the content (i.e. the stream), but also everything
else including the container to be identical, I believe the best
(perhaps only) choice is to use MPEG-TS as a container.

In theory, you should be able to split MPEG-TS files at arbitrary
bytes. I have bad experiences with that, but it works great at packet
boarders, meaning your segments need to be exact multiples of 188
bytes. This works great for all my players (ffplay, mplayer, mpv, VLC,
and my Set Top Box), and the binary splits can of course just be
reassembled to create the original file.

I often cut my files on Linux with dd:

$ dd if=input.ts bs=188 skip=10325 count=11877 of=output.ts

but for equally sized files, you would use "split", e.g.:

$ split --bytes=$((188 * 11877)) -d input.ts output.ts.

Cheers,
Moritz


More information about the ffmpeg-user mailing list