esup-pod

Arborescence des pages

Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

Paramétrage (optimisé) ffmpeg à utiliser dans Pod pour l'encodage GPU

Bloc de code
"""
FFMPEG SETTINGS LOCATE IN :
pod/video/encoding_settings.py
pod/video/encoding_gpu_settings.py
all settings can be overwritte in your settings locale
"""

FFMPEG_USE_GPU = True


FFMPEG_CMD_GPU = "ffmpeg -hwaccel_device 0 -hwaccel_output_format cuda -hwaccel cuda"hwaccel_output_format cuda -hwaccel cuda"
FFMPEG_PRESET_GPU = "p6"
FFMPEG_LEVEL_GPU = 0

FFMPEG_INPUT_GPU = '-hide_banner -threads %(nb_threads)s -i "%(input)s" '

FFMPEG_LEVEL = 0
FFMPEG_PRESET = "p6"
FFMPEG_PROFILELIBX_GPU = "high"
FFMPEG_LIBX = "h264_nvenc"

FFMPEG_MP4_ENCODE_GPU = (
    '%(cut)s -map 0:v:0 %(map_audio)s -c:v %(libx)s  -vf "scale_cuda=-2:%(height)s:interp_algo=bicubic:format=yuv420p" '
    + "-preset %(preset)s -profile:v %(profile)s "
    + "-level %(level)s "
    + "-forced-idr 1 "
    + "-b:v %(maxrate)s -maxrate %(maxrate)s -bufsize %(bufsize)s -rc vbr -rc-lookahead 20 -bf 1 "
    + '-force_key_frames "expr:gte(t,n_forced*1)" '
    + '-c:a aac -ar 48000 -b:a %(ba)s -movflags faststart -y -fps_mode passthrough "%(output)s" '
)

FFMPEG_HLS_COMMON_PARAMS_GPU = (
    "%(cut)s "
    + "-c:v %(libx)s -preset %(preset)s -profile:v %(profile)s "
    + "-level %(level)s "
    + "-forced-idr 1 "
    + '-force_key_frames "expr:gte(t,n_forced*1)" '
    + "-c:a aac -ar 48000 "
)

FFMPEG_HLS_ENCODE_PARAMS_GPU = (
    '-vf "scale_cuda=-2:%(height)s:interp_algo=bicubic:format=yuv420p" -maxrateb:v %(maxrate)s -b:a:0maxrate %(bamaxrate)s -bufsize %(maxratebufsize)s -rc constqp -b:a:v 0k0 %(ba)s -rc-lookahead 20vbr -bf 1 -qp 32 -2pass 1 -multipass 2 -spatial-aq 1 -aq-strength 11rc-lookahead 20 -bf 1 '
    + "-hls_playlist_type vod -hls_time %(hls_time)s  -hls_flags single_file "
    + '-master_pl_name "livestream%(height)s.m3u8" '
    + '-y "%(output)s" '
)

FFMPEG_CREATE_THUMBNAIL_GPU = (
    '-vf "select=between(t\,50\,10%(duration)s)*eq(pict_type\,PICT_TYPE_I),thumbnail_cuda=2,scale_cuda=-2:720:interp_algo=bicubic:format=yuv420p,hwdownload,format=yuv420p" -frames:v 3%(nb_thumbnail)s -vsync vfr "%(output)s_%%04d.png"'
)

Info

La commande FFMPEG_CREATE_THUMBNAIL permet ici de ne garder des miniatures (3) qu'entre les secondes 5 et 10 sur des frames complètes (PICT_TYPE_I).

A adapter en fonction de vos besoins.

...