PHPfox-Official / phpfox-v4-issues

phpFox Public Bug Tracker
https://phpfox.com
30 stars 21 forks source link

Question: where can we make changes to ffmpeg conversions for slow medium or fast processing ? #2941

Open spirogg opened 3 years ago

spirogg commented 3 years ago

Important

Please follow this template!


What's happened?

I THINK THIS IS GOOD IDEA PLEASE for v5 phpfox every website that you can upload videos has the player and the features especially in 2020 andyear 2021 please make this avail in new video app feature

I make a feature request here https://github.com/PHPfox-Official/phpfox-v4-feature-requests/issues/995

but still need the answer for where i can change the ffmpeg conversion for now

thanks Spiro ...

phpFox version

(Example: phpFox 4.6.0) 4.8.1 ...

Screenshots

...

harrison05 commented 3 years ago

Hi @spirogg

Speed of FFmpeg conversions based on the Cronjob cycle on your server. Because conversation only executes when cron run.

Regards.

spirogg commented 3 years ago

@harrison05 please see this encoding is faster with certain FMPEG libx264
example CRFs 18 to 27, and presets below

you can speed up the encoding using crf and presets when using ffmpeg

this will speed up the time the video processes and shows up on the website.

Presets:

ultrafast superfast veryfast faster fast medium slow slower veryslow

and CRF numbers you can control the speed and quality

example in this link shows

https://gist.github.com/mattst/2a0ff8de12e0fedb2ad72ccf7131bf71#file-testcliptwomindata-csv

so utrafast conversion time is 13.91 seconds and that should show pretty fast to the user then fast preset takes 79.71 seconds to conversion the same video these are examples, so depending on the preset and CRF you can control the quality Speed and File size of your conversion.

Example:

Choose an x264 encoding preset These presets affect the encoding speed. Using a slower preset gives you better compression, or quality per filesize, whereas faster presets give you worse compression. In general, you should just use the preset you can afford to wait for. Presets can be ultrafast, superfast, veryfast, faster, fast, medium (default), slow and veryslow. Here's an example:

ffmpeg -i input.mp4 -c:v libx264 -preset slow output.mp4

Encode lossless video This is possible by specifying a CRF of 0, so simply use -crf 0:

ffmpeg -i input.mp4 -c:v libx264 -crf 0 output.mp4

ALSO SEE: https://trac.ffmpeg.org/wiki/Encode/H.264

that is what I need to know where the ffmpeg file in phpfox is, to be able to play with it to see the difference on our conversion speed quality and file size of the uploaded videos

thanks

Spiro

spirogg commented 3 years ago

@harrison05 I found an older post this is the area I was looking for

here we can change Presets:

ultrafast superfast veryfast faster fast medium slow slower veryslow

this is Now /public_html/PF.Site/Apps/core-videos/Job/Encode.php EDIT /public_html/PF.Site/Apps/core-videos/Job/Encode.php you will find this around = line 140 thru 152

        $videoCommand .= '-vcodec libx264' . ' '
            . '-acodec aac' . ' '
            . '-strict experimental' . ' '
            . '-preset fast' . ' '
            . '-f mp4' . ' ';

EDIT /public_html/PF.Site/Apps/core-videos/Job/Encode.php you will find this around = line 148 thru 152

$videoCommand .= '-vcodec libx264' . ' '
. '-acodec aac' . ' '
. '-strict experimental' . ' '
. '-preset veryfast' . ' '
. '-f mp4' . ' ';

we can always use copy audio to not encode again

$videoCommand .= '-vcodec libx264' . ' '
            . '-c:a copy' . ' '
            . '-strict experimental' . ' '
            . '-preset veryfast' . ' '
            . '-f mp4' . ' ';

thanks,

Spiro