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