def test_ffmpeg_open_vcodec_acodec(session): with patch('streamlink.stream.ffmpegmux.which', return_value="ffmpeg"): f = FFMPEGMuxer(session, acodec="mp3", vcodec="avc") with patch('subprocess.Popen') as popen: f.open() popen.assert_called_with(['ffmpeg', '-nostats', '-y', '-c:v', 'avc', '-c:a', 'mp3', '-f', 'matroska', 'pipe:1'], stderr=ANY, stdout=ANY, stdin=ANY)
def test_ffmpeg_open_copyts(session): with patch('streamlink.stream.ffmpegmux.which', return_value="ffmpeg"): f = FFMPEGMuxer(session, copyts=True) with patch('subprocess.Popen') as popen: f.open() popen.assert_called_with(['ffmpeg', '-nostats', '-y', '-c:v', FFMPEGMuxer.DEFAULT_VIDEO_CODEC, '-c:a', FFMPEGMuxer.DEFAULT_AUDIO_CODEC, '-copyts', '-f', 'matroska', 'pipe:1'], stderr=ANY, stdout=ANY, stdin=ANY)
def test_ffmpeg_open_metadata_title(session): with patch('streamlink.stream.ffmpegmux.which', return_value="ffmpeg"): f = FFMPEGMuxer(session, metadata={None: ["title=test"]}) with patch('subprocess.Popen') as popen: f.open() popen.assert_called_with(['ffmpeg', '-nostats', '-y', '-c:v', FFMPEGMuxer.DEFAULT_VIDEO_CODEC, '-c:a', FFMPEGMuxer.DEFAULT_AUDIO_CODEC, '-metadata', 'title=test', '-f', 'matroska', 'pipe:1'], stderr=ANY, stdout=ANY, stdin=ANY)
def test_ffmpeg_open_format(session): with patch('streamlink.stream.ffmpegmux.which', return_value="ffmpeg"): session.options.set("ffmpeg-fout", "avi") f = FFMPEGMuxer(session, format="mpegts") with patch('subprocess.Popen') as popen: f.open() popen.assert_called_with(['ffmpeg', '-nostats', '-y', '-c:v', FFMPEGMuxer.DEFAULT_VIDEO_CODEC, '-c:a', FFMPEGMuxer.DEFAULT_AUDIO_CODEC, '-f', 'avi', 'pipe:1'], stderr=ANY, stdout=ANY, stdin=ANY)
def test_ffmpeg_open_vcodec_acodec_user_override(session): with patch('streamlink.stream.ffmpegmux.which', return_value="ffmpeg"): session.options.set("ffmpeg-video-transcode", "divx") session.options.set("ffmpeg-audio-transcode", "ogg") f = FFMPEGMuxer(session, acodec="mp3", vcodec="avc") with patch('subprocess.Popen') as popen: f.open() popen.assert_called_with(['ffmpeg', '-nostats', '-y', '-c:v', 'divx', '-c:a', 'ogg', '-f', 'matroska', 'pipe:1'], stderr=ANY, stdout=ANY, stdin=ANY)
def test_ffmpeg_open_copyts_enable_start_at_zero_user_override(session): with patch('streamlink.stream.ffmpegmux.which', return_value="ffmpeg"): session.options.set("ffmpeg-copyts", True) f = FFMPEGMuxer(session, copyts=False, start_at_zero=True) with patch('subprocess.Popen') as popen: f.open() popen.assert_called_with(['ffmpeg', '-nostats', '-y', '-c:v', FFMPEGMuxer.DEFAULT_VIDEO_CODEC, '-c:a', FFMPEGMuxer.DEFAULT_AUDIO_CODEC, '-copyts', '-start_at_zero', '-f', 'matroska', 'pipe:1'], stderr=ANY, stdout=ANY, stdin=ANY)