Skip to content

Commit

Permalink
Merge 9f12f4e into 576fb1a
Browse files Browse the repository at this point in the history
  • Loading branch information
zpavloudis committed Oct 3, 2021
2 parents 576fb1a + 9f12f4e commit b394ebf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions moviepy/video/VideoClip.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def write_videofile(
audio_codec=None,
audio_bitrate=None,
audio_bufsize=2000,
audio_ffmpeg_params=None,
temp_audiofile=None,
temp_audiofile_path="",
remove_temp=True,
Expand Down Expand Up @@ -286,6 +287,11 @@ def write_videofile(
Note that it mainly an indicative goal, the bitrate won't
necessarily be the this in the final file.
audio_ffmpeg_params
Any additional ffmpeg audio parameters you would like to specify
as a list of terms, like ['-af', 'acrusher=.1:1:64:0:log',
'-option2' 'value2' ]
preset
Sets the time that FFMPEG will spend optimizing the compression.
Choices are: ultrafast, superfast, veryfast, faster, fast, medium,
Expand Down Expand Up @@ -372,6 +378,7 @@ def write_videofile(
audio_nbytes,
audio_bufsize,
audio_codec,
ffmpeg_params=audio_ffmpeg_params,
bitrate=audio_bitrate,
write_logfile=write_logfile,
logger=logger,
Expand Down
12 changes: 12 additions & 0 deletions tests/test_PR.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,15 @@ def make_textclip(txt):

if __name__ == "__main__":
pytest.main()


def test_PR_1493_audio_params():
"""Test support for additional audio parameters for VideoClip."""
with VideoFileClip("media/chaplin.mp4") as clip:
with pytest.raises(IOError) as e:
clip.write_videofile(
"my_new_video.mp4",
audio_ffmpeg_params=["nonexistentparam", "acrusher=.1:1:64:0:log"],
)

assert "Invalid argument" in str(e.value)

0 comments on commit b394ebf

Please sign in to comment.