Berikut beberapa code penting untuk FFMPEG yang sering kita pakai
Replacing Audio Stream
If your input video already contains audio, and you want to replace it, you need to tell ffmpeg which audio stream to take:
ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 output.mp4
https://superuser.com/questions/277642/how-to-merge-audio-and-video-file-in-ffmpeg
Convert Stereo to Mono
Mix a single stereo stream down to a mono stream. Both channels of the stereo stream will be downmixed into the stream:
ffmpeg -i stereo.flac -ac 1 mono.flac
https://trac.ffmpeg.org/wiki/AudioChannelManipulation
Setting Encoding Video and Audio
Setting Audio: AAC, Mono, loudness -14 LUFS, 128 kbps
Setting Video: Tidak dirubah, hanya encode audio
ffmpeg -i xvideo.avi -c:v copy -acodec aac -b:a 128k -ac 1 -af loudnorm=I=-14:LRA=11:TP=-1 xoutput.mkv
Setting Video: MP4, CRF 17
Kalau belum ada suara di videonya, combine dengan begini:
ffmpeg -i xvideo.avi -i wavepad-mono-128kbps.aac -vcodec libx264 -crf 17 -acodec aac -b:a 128k -ac 1 -af loudnorm=I=-14:LRA=11:TP=-1 xoutput.mkv
Sudah ada suara di videonya? Tinggal gedein suara aja dan compress video ke h264 CRF 20 (perkiraan kualitas YouTube 1080p segitu)
ffmpeg -i xvideo.avi -vcodec libx264 -crf 17 -acodec aac -b:a 128k -ac 1 -af loudnorm=I=-14:LRA=11:TP=-1 xoutput.mkv
https://superuser.com/questions/1705712/is-ffmpeg-usable-with-audio-loudness-normalization
Tip: If you’re looking for an output that is roughly “visually lossless” but not technically lossless, use a -crf
value of around 17 or 18 (you’ll have to experiment to see which value is acceptable for you). It will likely be indistinguishable from the source and not result in a huge, possibly incompatible file like true lossless mode. [Source: FFMPEG]
Rekomendasi Audio: -14 LUFS, 128 kbps (Spotify)
We adjust tracks to -14 dB LUFS, according to the ITU 1770 (International Telecommunication Union) standard.
Target the loudness level of your master at -14dB integrated LUFS
and keep it below -1dB TP (True Peak) max. This is best for lossy
formats (Ogg/Vorbis and AAC) and makes sure no extra distortion’s
introduced in the transcoding process.
If your master’s louder than -14dB integrated LUFS, make sure
it stays below -2dB TP (True Peak) to avoid extra distortion. This
is because louder tracks are more susceptible to extra distortion
in the transcoding process.
https://artists.spotify.com/en/help/article/loudness-normalization
Rekomendasi Video: CRF x264 (Handbrake)
Recommended settings for x264 and x265 encoders:
- RF 18-22 for 480p/576p Standard Definition
- RF 19-23 for 720p High Definition
- RF 20-24 for 1080p Full High Definition
- RF 22-28 for 2160p 4K Ultra High Definition
Raising quality minus 1-2 RF may produce better results when encoding animated Sources (anime, cartoons). Lower quality settings may be used to produce smaller files. Drastically lower settings may show significant loss of detail.
Using higher than recommended quality settings can lead to extremely large files that may not be compatible with your devices. When in doubt, stick to the recommended range or use the default setting for the Preset you selected.
Display size and viewing distance
Imperfections tend to be more noticeable at larger display sizes and closer viewing distances. This is especially true for lower resolution videos (less than 720p), which are typically scaled or “blown up” to fill your display, magnifying even minor imperfections in quality.
You may wish to slightly increase quality for viewing on larger displays (50 inches / 125 cm diagonal or greater), or where viewing from closer than average distances5. Reduced quality may be acceptable for viewing on smaller screens or where storage space is limited, e.g. mobile devices.
https://handbrake.fr/docs/en/1.3.0/workflow/adjust-quality.html
Leave a Reply