1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5
6# build
7, cython
8, pkg-config
9, setuptools
10
11# runtime
12, ffmpeg
13
14# tests
15, numpy
16, pillow
17, pytestCheckHook
18}:
19
20buildPythonPackage rec {
21 pname = "av";
22 version = "10.0.0";
23 format = "pyproject";
24
25 disabled = pythonOlder "3.7";
26
27 src = fetchFromGitHub {
28 owner = "mikeboers";
29 repo = "PyAV";
30 rev = "v${version}";
31 hash = "sha256-XcHP8RwC2iwD64Jc7SS+t9OxjFTsz3FbrnjMgJnN7Ak=";
32 };
33
34 nativeBuildInputs = [
35 cython
36 pkg-config
37 setuptools
38 ];
39
40 buildInputs = [
41 ffmpeg
42 ];
43
44 preCheck = ''
45 # ensure we import the built version
46 rm -r av
47 '';
48
49 checkInputs = [
50 numpy
51 pillow
52 pytestCheckHook
53 ];
54
55 pytestFlagsArray = [
56 # Tests that want to download FATE data
57 # https://github.com/PyAV-Org/PyAV/issues/955
58 "--deselect=tests/test_audiofifo.py::TestAudioFifo::test_data"
59 "--deselect=tests/test_codec_context.py::TestCodecContext::test_codec_tag"
60 "--deselect=tests/test_codec_context.py::TestCodecContext::test_parse"
61 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_aac"
62 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_dnxhd"
63 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_dvvideo"
64 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_h264"
65 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_mjpeg"
66 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_mp2"
67 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_mpeg1video"
68 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_mpeg4"
69 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_pcm_s24le"
70 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_png"
71 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_tiff"
72 "--deselect=tests/test_codec_context.py::TestEncoding::test_encoding_xvid"
73 "--deselect=tests/test_decode.py::TestDecode::test_decode_audio_sample_count"
74 "--deselect=tests/test_decode.py::TestDecode::test_decoded_motion_vectors"
75 "--deselect=tests/test_decode.py::TestDecode::test_decoded_motion_vectors_no_flag"
76 "--deselect=tests/test_decode.py::TestDecode::test_decoded_time_base"
77 "--deselect=tests/test_decode.py::TestDecode::test_decoded_video_frame_count"
78 "--deselect=tests/test_encode.py::TestBasicAudioEncoding::test_transcode"
79 "--deselect=tests/test_file_probing.py::TestAudioProbe::test_container_probing"
80 "--deselect=tests/test_file_probing.py::TestAudioProbe::test_stream_probing"
81 "--deselect=tests/test_file_probing.py::TestDataProbe::test_container_probing"
82 "--deselect=tests/test_file_probing.py::TestDataProbe::test_stream_probing"
83 "--deselect=tests/test_file_probing.py::TestSubtitleProbe::test_container_probing"
84 "--deselect=tests/test_file_probing.py::TestSubtitleProbe::test_stream_probing"
85 "--deselect=tests/test_file_probing.py::TestVideoProbe::test_container_probing"
86 "--deselect=tests/test_file_probing.py::TestVideoProbe::test_stream_probing"
87 "--deselect=tests/test_python_io.py::TestPythonIO::test_reading_from_buffer"
88 "--deselect=tests/test_python_io.py::TestPythonIO::test_reading_from_buffer_no_see"
89 "--deselect=tests/test_python_io.py::TestPythonIO::test_reading_from_file"
90 "--deselect=tests/test_python_io.py::TestPythonIO::test_reading_from_pipe_readonly"
91 "--deselect=tests/test_python_io.py::TestPythonIO::test_reading_from_write_readonl"
92 "--deselect=tests/test_seek.py::TestSeek::test_decode_half"
93 "--deselect=tests/test_seek.py::TestSeek::test_seek_end"
94 "--deselect=tests/test_seek.py::TestSeek::test_seek_float"
95 "--deselect=tests/test_seek.py::TestSeek::test_seek_int64"
96 "--deselect=tests/test_seek.py::TestSeek::test_seek_middle"
97 "--deselect=tests/test_seek.py::TestSeek::test_seek_start"
98 "--deselect=tests/test_seek.py::TestSeek::test_stream_seek"
99 "--deselect=tests/test_streams.py::TestStreams::test_selection"
100 "--deselect=tests/test_streams.py::TestStreams::test_stream_tuples"
101 "--deselect=tests/test_subtitles.py::TestSubtitle::test_movtext"
102 "--deselect=tests/test_subtitles.py::TestSubtitle::test_vobsub"
103 "--deselect=tests/test_videoframe.py::TestVideoFrameImage::test_roundtrip"
104 ];
105
106 disabledTests = [
107 # urlopen fails during DNS resolution
108 "test_writing_to_custom_io"
109 ];
110
111 disabledTestPaths = [
112 # urlopen fails during DNS resolution
113 "tests/test_doctests.py"
114 "tests/test_timeout.py"
115 ];
116
117 pythonImportsCheck = [
118 "av"
119 "av.audio"
120 "av.buffer"
121 "av.bytesource"
122 "av.codec"
123 "av.container"
124 "av._core"
125 "av.datasets"
126 "av.descriptor"
127 "av.dictionary"
128 "av.enum"
129 "av.error"
130 "av.filter"
131 "av.format"
132 "av.frame"
133 "av.logging"
134 "av.option"
135 "av.packet"
136 "av.plane"
137 "av.stream"
138 "av.subtitles"
139 "av.utils"
140 "av.video"
141 ];
142
143 meta = with lib; {
144 description = "Pythonic bindings for FFmpeg/Libav";
145 homepage = "https://github.com/mikeboers/PyAV/";
146 license = licenses.bsd2;
147 maintainers = with maintainers; [ ];
148 };
149}