This repository has been archived on 2023-02-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
flamenco-worker/tests/test_commands_encode_audio.py
Sybren A. Stüvel 6477e908d1 Added support for commands used in the blender-video-chunks job type
Adds the following commands:

    - blender_render_audio
    - concat_videos
    - create_video
    - move_with_counter
    - mux_audio
2018-12-07 11:25:07 +01:00

49 lines
1.2 KiB
Python

import logging
import shutil
import typing
from pathlib import Path
import shlex
import subprocess
import sys
import tempfile
from tests.test_runner import AbstractCommandTest
log = logging.getLogger(__name__)
frame_dir = Path(__file__).with_name('test_frames')
class EncodeAudioTest(AbstractCommandTest):
settings: typing.Dict[str, typing.Any] = {
'ffmpeg_cmd': f'"{sys.executable}" -hide_banner',
'input_file': f'{frame_dir}/audio.flac',
'codec': 'aac',
'bitrate': '192k',
'output_file': f'{frame_dir}/audio.aac',
}
def setUp(self):
super().setUp()
from flamenco_worker.commands import EncodeAudioCommand
self.cmd = EncodeAudioCommand(
worker=self.fworker,
task_id='12345',
command_idx=0,
)
self.settings = self.__class__.settings.copy()
def test_build_ffmpeg_cmd(self):
self.cmd.validate(self.settings)
cliargs = self.cmd._build_ffmpeg_command(self.settings)
self.assertEqual([
sys.executable, '-hide_banner',
'-i', str(frame_dir / 'audio.flac'),
'-c:a', 'aac',
'-b:a', '192k',
'-y',
str(frame_dir / 'audio.aac'),
], cliargs)