|
2 | 2 | from os import path |
3 | 3 | from pprint import pprint |
4 | 4 |
|
| 5 | +from ffmpegio import image |
| 6 | +from matplotlib import pyplot as plt |
5 | 7 |
|
6 | | -url = "tests/assets/testvideo-5m.mp4" |
7 | | -if not path.isfile(url): |
8 | | - ffmpeg.run_sync( |
9 | | - { |
10 | | - "inputs": [("testsrc=r=30000/1001:d=300", {"f": "lavfi"})], |
11 | | - "outputs": [(url, None)], |
12 | | - "global_options": {"y": None}, |
13 | | - } |
14 | | - ) |
15 | | -pprint(probe.full_details(url)) |
| 8 | +command_list = ( |
| 9 | + { |
| 10 | + "inputs": [("testsrc=r=30000/1001:d=60", {"f": "lavfi"})], |
| 11 | + "outputs": [("tests/assets/testvideo-1m.mp4", None)], |
| 12 | + "global_options": {"y": None}, |
| 13 | + }, |
| 14 | + { |
| 15 | + "inputs": [ |
| 16 | + ( |
| 17 | + "aevalsrc = '0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)':d=60", |
| 18 | + {"f": "lavfi"}, |
| 19 | + ) |
| 20 | + ], |
| 21 | + "outputs": [("tests/assets/testaudio-1m.mp3", None)], |
| 22 | + "global_options": {"y": None}, |
| 23 | + }, |
| 24 | + { |
| 25 | + "inputs": [ |
| 26 | + ("testsrc=r=30000/1001:d=60", {"f": "lavfi"}), |
| 27 | + ( |
| 28 | + "aevalsrc = '0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)':d=60", |
| 29 | + {"f": "lavfi"}, |
| 30 | + ), |
| 31 | + ("testsrc2=d=60", {"f": "lavfi"}), |
| 32 | + ("anoisesrc=d=60:c=pink:r=44100:a=0.5:d=60", {"f": "lavfi"}), |
| 33 | + ], |
| 34 | + "outputs": [("tests/assets/testmulti-1m.mp4", {"map": (0, 1, 2, 3)})], |
| 35 | + "global_options": {"y": None}, |
| 36 | + }, |
| 37 | +) |
16 | 38 |
|
17 | 39 |
|
18 | | -url = "tests/assets/testvideo-5m.mpg" |
19 | | -if not path.isfile(url): |
20 | | - ffmpeg.run_sync( |
21 | | - { |
22 | | - "inputs": [("testsrc2=r=30000/1001:d=60", {"f": "lavfi"})], |
23 | | - "outputs": [ |
24 | | - ( |
25 | | - "tests/assets/testvideo-5m.mpg", |
26 | | - { |
27 | | - "flags": "+ildct+ilme", |
28 | | - "vf": "interlace=lowpass=0:scan=tff", |
29 | | - "c:v": "mpeg2video", |
30 | | - }, |
31 | | - ) |
32 | | - ], |
33 | | - "global_options": {"y": None}, |
34 | | - } |
35 | | - ) |
36 | | -pprint(probe.full_details(url)) |
| 40 | +for cfg in command_list: |
| 41 | + url = cfg["outputs"][0][0] |
| 42 | + if not path.isfile(url): |
| 43 | + ffmpeg.run_sync(cfg) |
| 44 | + pprint(probe.full_details(url)) |
0 commit comments