0

What's the best way to compress these kind of files with ffmpeg (in the fast possible way):

ffprobe -i file.mp4 

ffprobe version 4.3.4-0+deb11u1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:46:54.02, start: 0.000000, bitrate: 5133 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 4999 kb/s, 29.98 fps, 30 tbr, 90k tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[FORMAT]
filename=file.mp4
nb_streams=2
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=2814.016000
size=1805800118
bit_rate=5133730
probe_score=100
TAG:major_brand=isom
TAG:minor_version=512
TAG:compatible_brands=isomiso2avc1mp41
TAG:encoder=Lavf58.45.100
[/FORMAT]

ffmpeg -i input -c:v libx264 -preset ultrafast -qp 0 output.mkv

Also takes very long to complete

Ace
  • 109
  • 2
  • 1
    Do you want to have fast compression or effective compression? You cannot have both. Apart from that: What research have you done about the topic, what have you tried already to resolve the issue by yourself? – mashuptwice Jul 14 '22 at 11:23
  • I have tried several ffmpeg options but they all take very long to complete, I will update with the latest command line, but there are so many options that I'm lost, so I tried to ask the question as open as possible. I'm running it on a Azure VM with Debian. 'ffmpeg -i input -c:v libx264 -preset ultrafast -qp 0 output.mkv' – Ace Jul 14 '22 at 11:28
  • Your file is already encoded as h264, no need to reencode it with h264. Also: your question is still missing basic information about what you are trying to accomplish. It is not clear if you simply want to shrink the filesize, if you want to make your media compatible with some older device or if you want to do something different. "best way" is simply not an adequate description of your goal. Again: more effective compression will result in a smaller output file, but will take a significant amount of processing time. – mashuptwice Jul 14 '22 at 12:19
  • Yes I want to shrink the filesize – Ace Jul 14 '22 at 18:47
  • [Convert the files to h265/HEVC](https://superuser.com/a/785531/718047) adjust the [CRF](https://superuser.com/questions/677576/what-is-crf-used-for-in-ffmpeg) to your needs to change the output filesize/quality. If you have a powerful GPU, you can accelerate the encoding by using hardware acceleration. If you also encode the audio to mp3, the file should become even smaller – mashuptwice Jul 14 '22 at 19:08
  • Compressing the file size will take longer. That's nearly always the trade off wiry compression and encoding. – music2myear Jul 15 '22 at 01:36

0 Answers0