HostOnNet Blog

How to fix File for preset ‘hq’ not found error

Looking for Linux Server Admin or WordPress Expert? We can help.

After the successfull Youtube Clone Requirement installation for a client, uploaded a test video and got a convert error.

So verified following convert command on the server and got “File for preset ‘hq’ not found”

[root@ns530702 ~]# /usr/bin/ffmpeg -y -i '/var/www/vhosts/domain/video/test.avi' -acodec libfaac -ab 96k -vcodec libx264 -vpre hq -crf 22 -coder 1 -threads 0 -b 500k /var/www/vhosts/domain//flvideo/4ca4238a0b/15159863161117371024.mp4 2>&1
ffmpeg version 3.4.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.4.0 (Debian 6.4.0-10) 20171112
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, avi, from '/var/www/vhosts/domain/video/test.avi':
  Duration: 00:04:39.03, start: 0.000000, bitrate: 303 kb/s
    Stream #0:0: Video: h264 (Main) (H264 / 0x34363248), yuv420p(progressive), 320x180 [SAR 1:1 DAR 16:9], 92 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 192 kb/s
File for preset 'hq' not found

Searched with the error ‘File for preset ‘hq’ not found’ and got a solution from ubuntuforums.org.

Try something like the following for the x264 part of your commandline:

-vcodec libx264 -preset slow -crf 22

The script he was using vShare Youtube Clone and I updated the video conversion command at include/settings/video_conversion.php

Old code was

$cmd_mp4 = "$config[ffmpeg] -y -i '$video_src' -acodec libfaac -ab 96k -vcodec libx264 -vpre hq -crf 22 -coder 1 -threads 0 -b 500k $video_flv 2>&1";

Updated code

$cmd_mp4 = "$config[ffmpeg] -y -i '$video_src' -acodec libfaac -ab 96k -vcodec libx264 -vpre hq -crf 22 -coder 1 -threads 0 -b 500k $video_flv 2>&1";

Tried with new code and got another error


[root@ns530702 ~]# /usr/bin/ffmpeg -y -i '/var/www/vhosts/domain/video/test.avi' -acodec libfaac -ab 96k -vcodec libx264 -preset slow -crf 22 -coder 1 -threads 0 -b 500k /var/www/vhosts/domain/flvideo/4ca4238a0b/15159863161117371024.mp4 2>&1
ffmpeg version 3.4.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.4.0 (Debian 6.4.0-10) 20171112
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, avi, from '/var/www/vhosts/domain/video/test.avi':
  Duration: 00:04:39.03, start: 0.000000, bitrate: 303 kb/s
    Stream #0:0: Video: h264 (Main) (H264 / 0x34363248), yuv420p(progressive), 320x180 [SAR 1:1 DAR 16:9], 92 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 192 kb/s
Please use -b:a or -b:v, -b is ambiguous
Unknown encoder 'libfaac'

Updated convert code again.

Replaced -b with -b:a

Replaced libfaac with aac -strict -2. Before I fixed the Clip Bucket error with this solution.

Here is the final code. Tested with new convert command and video conversion working fine now.

$cmd_mp4 = "$config[ffmpeg] -y -i '$video_src' -acodec aac -strict -2 -ab 96k -vcodec libx264 -preset slow -crf 22 -coder 1 -threads 0 -b:a 500k $video_flv 2>&1";

About Sibi Antony

Bootstrap and Android LOVER. I've been creating things for the web for over 10 years, from the period of flash and table based layout web sites till mobile and tab friendly web sites.
Posted in Video Sharing

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.