Skip to content

Commit

Permalink
Feature 27324 Update audio codec (#670)
Browse files Browse the repository at this point in the history
* TTK-27324 Create new profile with dynamic waulity and trimming

* Update encoder.yaml

* Create output_dirname and output_basename vars

* TTK-27324 Update encoder.yml

* Update JobRender.php

---------

Co-authored-by: pablo.garcia <[email protected]>
Co-authored-by: Pablo Ogando Ferreira <[email protected]>
  • Loading branch information
3 people authored Dec 3, 2024
1 parent 174e090 commit cddac98
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
46 changes: 40 additions & 6 deletions config/packages/encoder.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


pumukit_encoder:
thumbnail:
width: 768
Expand Down Expand Up @@ -40,7 +42,7 @@ pumukit_encoder:
framerate: 25
channels: 1
audio: false
bat: ffmpeg -y -i "{{input}}" -acodec aac -vcodec libx264 -preset slow -crf 15 -threads 0 "{{output}}"
bat: ffmpeg -y -i "{{input}}" -acodec libfdk_aac -b:a 128k -ac 2 -ar 44100 -vcodec libx264 -preset slow -crf 15 -threads 0 "{{output}}"
streamserver:
name: Localmaster
type: store
Expand All @@ -66,7 +68,36 @@ pumukit_encoder:
framerate: 25
channels: 1
audio: false
bat: ffmpeg -y -i "{{input}}" -acodec aac -vcodec libx264 -preset slow -crf 22 -movflags faststart -threads 0 "{{output}}"
bat: ffmpeg -y -i "{{input}}" -acodec libfdk_aac -b:a 128k -ac 2 -ar 44100 -vcodec libx264 -preset slow -crf 22 -movflags faststart -threads 0 "{{output}}"
streamserver:
name: Localhost
type: download
host: 127.0.0.1
description: Local download server
dir_out: "%pumukit.downloads%"
url_out: "%pumukit.downloads_url%"
app: ffmpeg
rel_duration_size: 1
rel_duration_trans: 1
video_broadcastable_dynamic_quality:
generate_pic: false
display: false
wizard: true
master: false
nocheckduration: false
tags: html5 podcast
target: PUCHPODCAST
format: m3u8
codec: h264
mime_type: 'video/x-m3u8'
extension: m3u8
resolution_hor: 0
resolution_ver: 0
bitrate: 1 Mbps
framerate: 25
channels: 1
audio: false
bat: ffmpeg -y -i "{{input}}" -filter_complex "[0:v]split=3[v1][v2][v3]; [v1]scale=w=1920:h=1080[v1out]; [v2]scale=w=1280:h=720[v2out]; [v3]scale=w=640:h=360[v3out]" -map "[v1out]" -c:v:0 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -b:v:0 4M -maxrate:v:0 4M -bufsize:v:0 4M -pix_fmt yuv420p -tune film -acodec libfdk_aac -preset slow -g 50 -sc_threshold 0 -crf 20 -keyint_min 50 -map "[v2out]" -c:v:1 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -pix_fmt yuv420p -tune film -acodec libfdk_aac -b:v:1 3M -maxrate:v:1 1M -bufsize:v:1 1M -preset slow -g 50 -crf 22 -sc_threshold 0 -keyint_min 50 -map "[v3out]" -c:v:2 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -pix_fmt yuv420p -tune film -acodec libfdk_aac -b:v:2 775k -maxrate:v:2 775k -bufsize:v:2 775k -preset slow -g 50 -crf 24 -sc_threshold 0 -keyint_min 50 -map a:0 -c:a:0 libfdk_aac -b:a:0 96k -ac 2 -map a:0 -c:a:1 libfdk_aac -b:a:1 128k -ac 2 -map a:0 -c:a:2 libfdk_aac -b:a:2 128k -ac 2 -f hls -hls_time 10 -hls_init_time 1 -hls_playlist_type vod -hls_flags independent_segments -hls_segment_type mpegts -hls_segment_filename "{{output_dirname}}/stream_%%v/data%%02d.ts" -master_pl_name {{output_basename}} -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2" "{{output_dirname}}/stream_%v/stream.m3u8" -threads 0 -shortest
streamserver:
name: Localhost
type: download
Expand Down Expand Up @@ -94,7 +125,7 @@ pumukit_encoder:
framerate: 25
channels: 1
audio: false
bat: ffmpeg -y -i "{{input}}" -acodec aac -vcodec libx264 -preset slow -crf 22 -movflags faststart -threads 0 "{{output}}"
bat: ffmpeg -y -i "{{input}}" -acodec libfdk_aac -b:a 128k -ac 2 -ar 44100 -vcodec libx264 -preset slow -crf 22 -movflags faststart -threads 0 "{{output}}"
streamserver:
name: Localhost
type: download
Expand All @@ -112,7 +143,7 @@ pumukit_encoder:
tags: html5 audio podcast
target: PUCHWEBTV PUCHPODCAST*
format: mp4
codec: aac
codec: libfdk_aac
mime_type: 'audio/x-mp4'
extension: m4a
resolution_hor: 0
Expand All @@ -121,7 +152,7 @@ pumukit_encoder:
framerate: 0
channels: 1
audio: true
bat: ffmpeg -y -i "{{input}}" -acodec aac -vn -threads 0 "{{output}}"
bat: ffmpeg -y -i "{{input}}" -acodec libfdk_aac -b:a 128k -ac 2 -ar 44100 -vn -threads 0 "{{output}}"
streamserver:
name: Localhost
type: download
Expand Down Expand Up @@ -186,9 +217,12 @@ pumukit_encoder:
target_default_profiles:
PUCHWEBTV:
audio: "audio_broadcastable"
video: "video_broadcastable"
video: "video_broadcastable video_broadcastable_dynamic_quality"
image: "image_broadcastable image_raw_broadcastable"
document: "document_broadcastable"
PUCHPODCAST:
audio: "audio_broadcastable"
video: "video_broadcastable audio_broadcastable"
PUCHLMS:
audio: "audio_broadcastable"
video: "video_broadcastable"
2 changes: 2 additions & 0 deletions src/Pumukit/EncoderBundle/Services/JobRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public function renderBat(Job $job): string

$vars['input'] = $job->getPathIni();
$vars['output'] = $job->getPathEnd();
$vars['output_dirname'] = dirname($vars['output']);
$vars['output_basename'] = basename($vars['output']);

foreach (range(1, 9) as $identifier) {
$vars['tmpfile'.$identifier] = $this->tmpPath.'/'.random_int(0, mt_getrandmax());
Expand Down

0 comments on commit cddac98

Please sign in to comment.