rdp / ffmpeg-windows-build-helpers

Helper script for cross compiling some media tools for windows, like customizable ffmpeg.exe (with or without non-free components, etc), and some other bonuses like mplayer, mp4box, mxf, etc.
GNU General Public License v3.0
1.09k stars 414 forks source link

Heavy output build on Windows #689

Closed RobinFrcd closed 1 year ago

RobinFrcd commented 1 year ago

Hi, I successfully managed to compile a minimal standalone FFmpeg binary to create MP4 videos from JPG images encoded with x264. The binary is 100% functional and is 5.2MB.

To do that, I used:

./configure \
--disable-everything \
--enable-decoder=mjpeg \
--enable-encoder=libx264 \
--enable-protocol=concat,file \
--enable-demuxer=image2 \
--enable-muxer=mp4 \
--enable-filter=scale \
--enable-gpl \
--enable-libx264 \
--extra-ldexeflags="-static" \
--pkg-config="pkg-config --static"

I now would like to build the macOS and windows binaries directly from my Linux machine. I tried the quick_cross_compile_ffmpeg_fdk_aac_and_x264_using_packaged_mingw64 script and replaced the config args with mine, but the output exe is 30MB+. Is there any reason why the windows build is 6x bigger than the linux one ?

Thanks

rdp commented 1 year ago

What does the ffmpeg.exe output look like?

On Thu, Mar 9, 2023 at 10:22 AM Robin Fourcade @.***> wrote:

Hi, I successfully managed to compile a minimal standalone FFmpeg binary to create MP4 videos from JPG images encoded with x264. The binary is 100% functional and is 5.2MB.

To do that, I used:

./configure \ --disable-everything \ --enable-decoder=mjpeg \ --enable-encoder=libx264 \ --enable-protocol=concat,file \ --enable-demuxer=image2 \ --enable-muxer=mp4 \ --enable-filter=scale \ --enable-gpl \ --enable-libx264 \ --extra-ldexeflags="-static" \ --pkg-config="pkg-config --static"

I now would like to build the macOS and windows binaries directly from my Linux machine. I tried the quick_cross_compile_ffmpeg_fdk_aac_and_x264_using_packaged_mingw64 https://github.com/rdp/ffmpeg-windows-build-helpers/blob/master/quick_build/quick_cross_compile_ffmpeg_fdk_aac_and_x264_using_packaged_mingw64.sh#L86 script and replaced the config args with mine, but the output exe is 30MB+. Is there any reason why the windows build is 6x bigger than the linux one ?

Thanks

— Reply to this email directly, view it on GitHub https://github.com/rdp/ffmpeg-windows-build-helpers/issues/689, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUCXRULFDWX5FGF2W5DW3IGVHANCNFSM6AAAAAAVVMZKTU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

RobinFrcd commented 1 year ago

Here's the output

Z:\>ffmpeg.exe
ffmpeg version git-2023-03-08-aca7ef7 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 10-win32 (GCC) 20220113
  configuration: --enable-gpl --enable-libx264 --enable-nonfree --enable-debug=3 --disable-optimizations --arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --pkg-config=pkg-config --prefix=/home/robz/dev/tools/ffmpeg-windows-build-helpers/sandbox_quick/win64/quick_install/install_root/ffmpeg_simple_installed
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  6.100 / 60.  6.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Hyper fast Audio and Video encoder
rdp commented 1 year ago

Disable optimizations make a difference?

On Friday, March 17, 2023, Robin Fourcade @.***> wrote:

Here's the output

Z:>ffmpeg.exe ffmpeg version git-2023-03-08-aca7ef7 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 10-win32 (GCC) 20220113 configuration: --enable-gpl --enable-libx264 --enable-nonfree --enable-debug=3 --disable-optimizations --arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --pkg-config=pkg-config --prefix=/home/robz/dev/tools/ffmpeg-windows-build-helpers/sandbox_quick/win64/quick_install/install_root/ffmpeg_simple_installed libavutil 58. 3.100 / 58. 3.100 libavcodec 60. 6.100 / 60. 6.100 libavformat 60. 4.100 / 60. 4.100 libavdevice 60. 2.100 / 60. 2.100 libavfilter 9. 4.100 / 9. 4.100 libswscale 7. 2.100 / 7. 2.100 libswresample 4. 11.100 / 4. 11.100 libpostproc 57. 2.100 / 57. 2.100 Hyper fast Audio and Video encoder

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.< https://ci4.googleusercontent.com/proxy/3CulxI3ZyLjCx1CJf2O-vLLogXYPMePYjVQADGHVOiFehkF5-n_hkkqalGJ99ZP09CupLs-6Y3p5GS-YJu5vrGtFiOvu_H6ICthSyz3D9oN7JxVkZ93pFvvs_LYW73jroCGWCa_XhUzQQby7JdzA1-B9BLPXFQTbtC_OFV22nak_e2NHPiBdW1s5PK1193yjCKS3gNtA-XrMFaJArI5kzjkJTLQHtnIfCgto5nkJOmrN9aQsgw=s0-d-e1-ft#https://github.com/notifications/beacon/AAADBUCMEYRUPXGOQGOUOY3W4RHPXA5CNFSM6AAAAAAVVMZKTWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSX25OXQ.gif>Message ID: @.***>

RobinFrcd commented 1 year ago

@rdp What do you mean ? --disable-optimizations is already in the flag of the binary

rdp commented 1 year ago

It's not in your linux build?

On Mon, Mar 20, 2023 at 10:30 AM Robin Fourcade @.***> wrote:

@rdp https://github.com/rdp What do you mean ? --disable-optimizations is already in the flag of the binary

— Reply to this email directly, view it on GitHub https://github.com/rdp/ffmpeg-windows-build-helpers/issues/689#issuecomment-1476563305, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUAN47KR77P2RNZWNG3W5CAZ5ANCNFSM6AAAAAAVVMZKTU . You are receiving this because you were mentioned.Message ID: @.***>

RobinFrcd commented 1 year ago

Oh, I tried to fully delete the sandbox_quick folder and now it works ! 3.9MB is far better ! I guess I had some cache from the previous run.

Thanks for your help !

rdp commented 1 year ago

So same configure settings?

On Monday, March 20, 2023, Robin Fourcade @.***> wrote:

Oh, I tried to fully delete the sandbox_quick folder and now it works ! 3.9MB is far better ! I guess I had some cache from the previous run.

Thanks for your help !

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.< https://ci4.googleusercontent.com/proxy/tezuQCPKwS5OD7akEFPSp75bWhWzBsCb4AQ_2Ind-wmsLMOh5jb0gS_z7w-SwKoUp8mFwC628l4JP6ZanLEcZ0VjTjkTvwOHvXCHHW5coswNB98NqpN__s--mL3b50o1DLhOLaKn5SjPn8qJJ2WglaWdpTeulfKP7cqpxlnlAQa7ZcBrhsxTuyFjrE8oHW2XBEw5B9geuPgE5oYf7oDrRCLxFf1lHFuSsMiv2dWAuXvsxixMfQ=s0-d-e1-ft#https://github.com/notifications/beacon/AAADBUB5P5NHD3PQDMTOSSLW5CFTDA5CNFSM6AAAAAAVVMZKTWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSYAOD56.gif>Message ID: @.***>

RobinFrcd commented 1 year ago

Yes, actually it's 4.4MB with this. And 3.9MB if I add --enable-small

cd $ffmpeg_dir
  # not ready for this since we don't reconfigure after changes: # git pull
  if [[ ! -f ffbuild/config.mak ]]; then
    # shouldn't really ever need these?
    ./configure --disable-everything \
      --enable-decoder=mjpeg \
      --enable-encoder=libx264 \
      --enable-protocol=concat,file \
      --enable-demuxer=image2 \
      --enable-muxer=mp4 \
      --enable-filter=scale \
      --enable-gpl \
      --enable-libx264 \
      --extra-ldexeflags="-static" \
      --pkg-config="pkg-config --static" \
      --arch=$arch --target-os=mingw32 \
      --cross-prefix=$host- --pkg-config=pkg-config --prefix=$prefix/ffmpeg_simple_installed || exit 1
  fi
  rm **/*.a # attempt force a kind of rebuild...
  make -j$cpu_count && make install && echo "done installing it $prefix/ffmpeg_simple_installed"
cd ..