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