• Welcome to WooUSEFUL by PHPVIBE . Please log in.
avatar_Marius

[ Video Sharing CMS v4 ] FFMPEG transcoding for Quality

Started by Marius,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MariusTopic starter


{ffmpeg-cmd} -i {input} -c:v libx264 -preset slow -crf 18 -vf yadif -strict -2 {output}.mp4

When file size is not an issue, this is a quick command that will produce a visually lossless H.264 encoding with an mp4 container. C:V is the video codec of choice, preset is the compression preset (in this case slow for higher quality compression), and CRF is the Constant Rate Factor, which preserves an overall level of quality throughout the file by adjusting each frame's bitrate based on the given quality level. Consequently, the higher the CRF, the lower the overall quality level.
The video filter flag (-vf) is used to call FFMPEG's pre-bundled video filters, while yadif (Yet Another Deinterlacing Filter) deinterlaces an interlaced input, as progressive video is not only easier to compress and most current computer monitors and televisions are progressive scan.
Finally, when encoding with H.264/MPEG-4 AVC, the audio format used is AAC (Advanced Audio Coding); in order to enable FFMPEG's experimental, native AAC encoder, -strict -2 needs to be added to the command. An external library such as libfaac [4] can also be used, and –strict -2 can be omitted.


A preservation quality master can be output using the same principles, setting the –crf to 0, the preset to veryslow, and the output container to .mkv:


{ffmpeg-cmd} -i {input} -c:v libx264 -preset veryslow -crf 0 -vf yadif -strict -2 output.mp4

A preservation quality master can be output using the same principles, setting the –crf to 0, the preset to veryslow, and the output container to .mkv:


{ffmpeg-cmd} -i {input} -c:v libx264 -preset veryslow -crf 0 -vf  yadif -strict -2 output.mp4
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

MariusTopic starter

Beta-testing on VideoInedit:

$output ="{ffmpeg-cmd} -i {input} -c:v libx264 -preset slow -crf 18 -vf yadif -strict -2 -movflags faststart {output}.mp4";



Sample: http://www.videoinedit.com/video/7486/transformers-4-official-trailer-hd-1080p-/
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

MariusTopic starter

Quote from: @Mario on
Beta-testing on VideoInedit:
....



Note, this is really heavy on 2.3 gb full 720p movie, and also slow.
This hardware: 8 gb, 2.4 quad-core intel.





If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

MariusTopic starter

After about 2h of conversion : http://www.videoinedit.com/video/7487/scooby-doo-frankencreepy-2014-720p-x264/
The video quality is almost to 100% as the original .mkv video file.
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

Similar topics (7)