File: test_toolkit_ffmpeg.py

package info (click to toggle)
audio-visualizer-python 2.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 948 kB
  • sloc: python: 6,683; sh: 15; makefile: 10
file content (64 lines) | stat: -rw-r--r-- 1,386 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import pytest
from avp.toolkit.ffmpeg import createFfmpegCommand
from . import audioData, getTestDataPath, command


def test_readAudioFile_data(audioData):
    assert len(audioData[0]) == 218453


def test_readAudioFile_duration(audioData):
    assert audioData[1] == 3.95


@pytest.mark.parametrize("width, height", ((1920, 1080), (1280, 720)))
def test_createFfmpegCommand(command, width, height):
    command.settings.setValue("outputWidth", width)
    command.settings.setValue("outputHeight", height)
    ffmpegCmd = createFfmpegCommand("test.ogg", "/tmp", command.core.selectedComponents)
    assert ffmpegCmd == [
        "ffmpeg",
        "-loglevel",
        "info",
        "-thread_queue_size",
        "512",
        "-y",
        "-f",
        "rawvideo",
        "-vcodec",
        "rawvideo",
        "-s",
        "%sx%s" % (width, height),
        "-pix_fmt",
        "rgba",
        "-r",
        "30",
        "-t",
        "0.100",
        "-an",
        "-i",
        "-",
        "-t",
        "0.100",
        "-i",
        "test.ogg",
        "-map",
        "0:v",
        "-map",
        "1:a",
        "-vcodec",
        "libx264",
        "-acodec",
        "aac",
        "-b:v",
        "2500k",
        "-b:a",
        "192k",
        "-pix_fmt",
        "yuv420p",
        "-preset",
        "medium",
        "-f",
        "mp4",
        "/tmp",
    ]