FFMPEG changes bitrate after splitting a file

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

FFMPEG changes bitrate after splitting a file

Julien Dotsev
Hi,
I want to split a file by file size but as I can not find that option I
thought of  doing it by calculating the size using the bitrates. The
problem is that when I split a file with the command line tool i
receive different bitrates. I use this code to split the file:

*ffmpeg -i test.mp4 -ss 00:00:00 -to 00:20:00 -c copy test_output.mp4*

and this is my result:















































*D:\Desktop\ffmpeg\ffmpeg\bin>ffmpeg -i test.mp4 -ss 00:00:00 -to 00:20:00
-c copy test_output.mp4ffmpeg version git-2019-10-13-4f4334b Copyright (c)
2000-2019 the FFmpeg developers  built with gcc 9.2.1 (GCC) 20191010
configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libdav1d --enable-libbluray --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp
--enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc
--enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom
--enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va
--enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
--enable-libopenmpt --enable-amf  libavutil      56. 35.100 / 56. 35.100
libavcodec     58. 59.102 / 58. 59.102  libavformat    58. 33.100 / 58.
33.100  libavdevice    58.  9.100 / 58.  9.100  libavfilter     7. 62.100 /
 7. 62.100  libswscale      5.  6.100 /  5.  6.100  libswresample   3.
 6.100 /  3.  6.100  libpostproc    55.  6.100 / 55.  6.100Input #0,
mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':  Metadata:    major_brand     :
mp42    minor_version   : 0    compatible_brands: isommp42    creation_time
  : 2019-03-13T11:57:44.000000Z  Duration: 00:01:28.49, start: 0.000000,
bitrate: 608 kb/s    Stream #0:0(und): Video: h264 (Main) (avc1 /
0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 477 kb/s, 25
fps, 25 tbr, 12800 tbn, 50 tbc (default)    Metadata:      creation_time
: 2019-03-13T11:57:44.000000Z      handler_name    : ISO Media file
produced by Google Inc. Created on: 03/13/2019.    Stream #0:1(und): Audio:
aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
Metadata:      creation_time   : 2019-03-13T11:57:44.000000Z
handler_name    : ISO Media file produced by Google Inc. Created on:
03/13/2019.Output #0, mp4, to 'test_output.mp4':  Metadata:    major_brand
    : mp42    minor_version   : 0    compatible_brands: isommp42    encoder
        : Lavf58.33.100    Stream #0:0(und): Video: h264 (Main) (avc1 /
0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 477
kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)    Metadata:
creation_time   : 2019-03-13T11:57:44.000000Z      handler_name    : ISO
Media file produced by Google Inc. Created on: 03/13/2019.    Stream
#0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127
kb/s (default)    Metadata:      creation_time   :
2019-03-13T11:57:44.000000Z      handler_name    : ISO Media file produced
by Google Inc. Created on: 03/13/2019.Stream mapping:  Stream #0:0 -> #0:0
(copy)  Stream #0:1 -> #0:1 (copy)Press [q] to stop, [?] for helpframe=
2109 fps=0.0 q=-1.0 Lsize=    6033kB time=00:01:28.46 bitrate= 558.6kbits/s
speed= 279xvideo:4582kB audio:1383kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 1.139301%*


Is there anyway to conserve the origina bitrates or to split the file by
size?

Thank you in advance

Julien Dotsev
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG changes bitrate after splitting a file

Noeck
Hi Julian,

all frames have different sizes depending on the content’s complexity
and groups of pictures have different sizes mostly depending on how
quickly the image changes. That’s why the bitrate varies over time and
every part (split) of the video has a different bitrate. The overall
bitrate is an average of all individual bitrates (weighted by duration
of the splits).

You can limit the file size of one part with the -fs option, but you
know only afterwards how long it got. And then you can use this duration
to start the next part from this point in time.

Some more hints:

https://stackoverflow.com/questions/38259544/using-ffmpeg-to-split-video-files-by-size
https://superuser.com/questions/712893/how-to-split-a-video-file-by-size-with-ffmpeg

Cheers,
Daniel
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG changes bitrate after splitting a file

Julien Dotsev
Thank's a lot for your answer. It was very helpful.

Julien


On Mon, 14 Oct 2019, 10:00 Noeck, <[hidden email]> wrote:

> Hi Julian,
>
> all frames have different sizes depending on the content’s complexity
> and groups of pictures have different sizes mostly depending on how
> quickly the image changes. That’s why the bitrate varies over time and
> every part (split) of the video has a different bitrate. The overall
> bitrate is an average of all individual bitrates (weighted by duration
> of the splits).
>
> You can limit the file size of one part with the -fs option, but you
> know only afterwards how long it got. And then you can use this duration
> to start the next part from this point in time.
>
> Some more hints:
>
>
> https://stackoverflow.com/questions/38259544/using-ffmpeg-to-split-video-files-by-size
>
> https://superuser.com/questions/712893/how-to-split-a-video-file-by-size-with-ffmpeg
>
> Cheers,
> Daniel
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG changes bitrate after splitting a file

kumowoon1025
Also consider the fact that there’s going to be at least the minimum of container header and muxing overhead.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".