def main(): parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', required=True, help='The path to the video file (required).') parser.add_argument('-o', '--output', default=None, help='The output to write files.') args = parser.parse_args() rep1 = Representation(width=256, height=144, kilo_bitrate=200, audio_k_bitrate=64) rep2 = Representation(width=854, height=480, kilo_bitrate=500, audio_k_bitrate=128) rep3 = Representation(width=1080, height=720, kilo_bitrate=1000, audio_k_bitrate=320) (ffmpeg_streaming.dash( args.input, adaption='"id=0,streams=v id=1,streams=a"').format('libx265').add_rep( rep1, rep2, rep3).package(args.output, progress=transcode_progress))
def main(): cloud = Cloud() download_options = { 'url': 'https://www.aminyazdanpanah.com/my_sweetie.mp4', 'progress': download_progress } upload_options = { 'url': 'https://localhost:8000/api/upload', 'method': 'post', 'field_name': 'YOUR_FIELD_NAME', 'auth': ('username', 'password'), 'headers': { 'User-Agent': 'Mozilla/5.0 (compatible; AminYazdanpanahBot/1.0; +http://aminyazdanpanah.com/bots)', 'Accept': 'application/json', 'Authorization': 'Bearer ACCESS_TOKEN' } } from_cloud = (cloud, download_options, None) to_cloud = (cloud, upload_options) (ffmpeg_streaming.dash(from_cloud, adaption='"id=0,streams=v id=1,streams=a"').format( 'libx265').auto_rep().package( '/var/www/media/stream.mpd', to_cloud, transcode_progress))
def main(): from_custom_cloud, to_custom_cloud = custom_cloud() (ffmpeg_streaming.dash(from_custom_cloud, adaption='"id=0,streams=v id=1,streams=a"').format( 'libx265').auto_rep().package( clouds=to_custom_cloud, progress=transcode_progress))
def main(): from_cloud, to_cloud = cloud() (ffmpeg_streaming.dash(from_cloud, adaption='"id=0,streams=v id=1,streams=a"').format( 'libx265').auto_rep().package( '/var/www/media/stream.mpd', to_cloud, progress=transcode_progress))
def main(): from_aws_cloud, to_aws_cloud = aws_cloud('bucket_name', 'key') from_azure_cloud, to_azure_cloud = azure_cloud('container', 'blob') from_google_cloud, to_google_cloud = google_cloud('bucket_name', 'object_name') (ffmpeg_streaming.dash( '/var/www/media/video.mkv', adaption='"id=0,streams=v id=1,streams=a"').format( 'libx265').auto_rep().package( output='/var/www/media/stream.mpd', clouds=[to_aws_cloud, to_azure_cloud, to_google_cloud], progress=transcode_progress))
def test_dash(self): dash_obj = ffmpeg_streaming.dash(self.src_video) self.assertIsInstance(dash_obj, DASH) self.assertEqual(dash_obj.filename, self.src_video) dash_obj.auto_rep() dash_obj.format('libx265') dash_obj.package(os.path.join(self.src_dir, 'dash', 'test.mpd'), c_stderr=False) with open(os.path.join(self.src_dir, 'dash', 'test.mpd')) as test_mpd: actual_mpd = test_mpd.readlines() self.assertEqual(actual_mpd[0].replace('\n', ''), '<?xml version="1.0" encoding="utf-8"?>') self.assertEqual(actual_mpd[1].replace('\n', ''), '<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"')
def main(): parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', required=True, help='The path to the video file (required).') parser.add_argument('-o', '--output', default=None, help='The output to write files.') args = parser.parse_args() (ffmpeg_streaming.dash(args.input, adaption='"id=0,streams=v id=1,streams=a"').format( 'libx265').auto_rep().package( args.output, transcode_progress))
def main(): parser = argparse.ArgumentParser() parser.add_argument( '-i', '--input', required=True, help='The path to the video file(or a supported resource) (required).') parser.add_argument( '-o', '--output', required=True, help= 'A URL(or a supported resource e.x. http://website.com/live-out.mpd) to upload files.' ) args = parser.parse_args() (ffmpeg_streaming.dash(args.input, adaption='"id=0,streams=v id=1,streams=a"').format( 'libx265').auto_rep().live(args.output, progress=progress))
def main(): parser = argparse.ArgumentParser() parser.add_argument('-b', '--bucket_name', required=True, help='Bucket name (required).') parser.add_argument('-k', '--key', required=True, help='Key name (required)') args = parser.parse_args() from_aws_cloud, to_aws_cloud = aws_cloud(args.bucket_name, args.key) (ffmpeg_streaming.dash(from_aws_cloud, adaption='"id=0,streams=v id=1,streams=a"').format( 'libx265').auto_rep().package( '/var/www/media/stream.mpd', to_aws_cloud, transcode_progress))
def create_dash_files(_input, _output, __progress=None): (ffmpeg_streaming.dash(_input, adaption='"id=0,streams=v id=1,streams=a"').format( 'libx265').auto_rep().package( _output, __progress))
import ffmpeg_streaming (ffmpeg_streaming.dash( '/var/www/media/videos/test.mp4', adaption='"id=0,streams=v id=1,streams=a"').format( 'libx265').auto_rep().package('/var/www/media/videos/dash/test.mpd'))