Ffmpeg / cuda status and quality (CPU / GPU)

ffmpeg Am I doing this right?

How long has it been since I used ffmpeg to convert clips on my home web server, now that mp4 (h264 and aac) is the current common standard (works on every console, smartphone, smartTV, pc) I decided to convert my old clips from various digital cameras to this new container / codecs.

  • less space and the same quality.
  • Compatibility
  • tag support (subler for mac)

after some research, I chose ffmpeg for various reasons.

  • commandline (I made my simple web interface with default settings that I execute with php exec)
  • size / size

I read that many expensive video conversion softwares cannot handle low bitrate videos correctly. I also tested some of them and personally I could not find the correct export options or I was not impressed with the results ... some had fixed default export settings, most had lower video quality in the same file. ffmpeg allows me to set -crf (usually 18-24) and -preset (veryslow, fast ..) which allows me to reduce file size, visible quality.

Said I use the preset on veryslow (there is also a placebo in there, but the final video is only 1% smaller).

And here is the command I am using

ffmpeg
-y //overwrite the file if it exists

-i INPUTFILE // replace with the input file

-metadata title=THETITLE // set a nice title, visible on modern devices
-metadata date=THEDATE // set a nice title, visible on modern devices

-c:v libx264 // use the h264 codec
 -crf 21 // try different numbers between 18-26
 -preset veryslow // placebo,slow,fast,ultrafast==big file 
 -tune film // tune it a little
 -pix_fmt yuv420p // preferred on most modern devices
 -profile:v main // preferred on most modern devices
 -level 3.1 // preferred on most modern devices 
 -refs 4 // preferred on most modern devices

-c:a libfdk_aac // use aac
 -metadata:s:a language=eng // set a language, visible on modern devices 
 -b:a 128k // audio bitrate 128k is like mp3 192k
 -ar 48000 // 44100 ... whatever
 -ac 2 // audiochannels
 -movflags +faststart //move the metadata in the front of the video so it loads faster

OUTPUTFILE

      

some m2ts camcorders already have an avc / h264 compatible codec, so I just copy the stream. some have ac3 / dolby sorround sound. I am converting audio, but support ac3 as a second audio track displaying ffmpeg streams. It allows me to view mp4 in browsers and mobile devices, but I can save surround sound for playback on some TVs, advanced media players or devices like apple TV.

not that i'm not happy with the speed (using a quad core), but recently i read again about cuda opencl and there is also the simple fact that i don't use other converters than ffmpeg as it is time consuming.

Is ffmpeg (with the setting I'm using) a good converter for keeping the same video quality as the source, reducing the footprint and an average of 30-40%?

Is the GPU conversion really that bad (cuda .. testing gtx970)? it would be nice to add some more speed for conversions using both gpu and cpu. But for my understanding, they cannot work together? and using only gpu is a drastic decrease in quality ... cpu si is more accurate, gpu is faster computed too imprecise from what I read .. so expensive software uses cuda for preview purposes only ... right?

Is ffmpeg or other software compatible with CPU + GPU encoding? I don't really remember where, but I read that ffmpeg is not a good video converter.

I'm really happy with the size and quality, I got an average of 30% in space with no visible loss of quality. With some additional options, I can tweak some really old analog videos that deinterlace very badly.

maybe i could get more size / quality with other software ???

note: I like ffmpeg.it for free and it has a command line so I can create my own interface with php html and js and use it on different machines without having to install it on every device I use. i uplad clicks idevice directly to ffmpeg server.

btw: explain downvotes ...

EDIT:

@talonmies ... cuda tag removed:

http://www.nvidia.com/object/cuda_home_new.html

CUDAยฎ is a parallel computing platform and programming model invented by NVIDIA. This can significantly increase computing performance by using the power of the graphics processing unit (GPU). With millions of CUDA-enabled GPUs sold to date, software developers, scientists and researchers are finding widespread use for GPU computing with CUDA. Here are some examples: - See more at: http://www.nvidia.com/object/cuda_home_new.html#sthash.dEYaqae7.dpuf

is not a programming model that the theoretical ffmpeg library should support to handle GPU encoding on nvidia cards like the gtx 970 ?? as badaboom software http://www.geforce.com/games-applications/pc-applications/badaboom-media-converter .

+3


source to share


2 answers


Is ffmpeg (with the setting I'm using) a good converter for keeping the same video quality as the source, reducing the footprint and an average of 30-40%?

There are many factors to consider, but as a broad generalization, you can get a "visually lossless, or nearly as much, but most users - can't tell, but not technically lossless" output, which is also smaller than the input. Start with ~ -crf 18

, then increase it until you reach the highest value that still provides acceptable quality. Use this value for the rest of your encoding.

If it's too slow, use a faster one -preset

.

See FFmpeg Wiki: H.264 Video Encoding Guide for details .



Is ffmpeg or other software compatible with CPU + GPU encoding?

  • FFmpeg supports nvenc

    . Get the NVIDIA Video Coding SDK , then compile ffmpeg

    with --enable-nonfree --enable-nvenc

    . It will likely be slower than x264 while delivering similar quality, but can be useful if your CPU is already busy.

  • x264 can support OpenCL ( --opencl

    option) for lookahead and maybe some other stuff, but it might not be worth using and might even be slower. You just have to try and compare; if you have compatible hardware.

  • Coders who claim to be using a GPU (GP) "in some way are often slower and / or lower quality than the usual x264.

I read that ffmpeg is not a good video converter

Without any reason, this sounds like an unfounded opinion.

+2


source


Is ffmpeg (with the setting i use) a good converter to keep the same video quality than the source reducing the space occupied by and average of 30-40% ?

Typically, in this case, you are using libx264 to convert the video, try it and see. Maybe try different values โ€‹โ€‹for -crf. Remember that this conversion [if crf is very low] will be lost.



Is GPU conversion bad?

This is probably not bad, depending on how you use it. FFmpeg doesn't actually support any [command line] hardware GPU decoding / encoding, AFAIK.

0


source







All Articles