PW Akshay

Generation

generate functionTue, 17 Jan 2023

create a python program to stream video from m3u8 url to youtube using python-ffmpeg-video-streaming module (do not create function)(do not use subprocess)

import requests from ffmpeg_streaming import Formats, Bitrate, Representation, Size from ffmpeg_streaming import HLS def main(): url = "http://www.streambox.fr/playlists/test_001/stream.m3u8" response = requests.get(url, stream=True) print(response) #print(response.text) if response.status_code == 200: representation = Representation(Bitrate(128 * 1024), Size(640, 480)) hls_stream = HLS(representation) hls_stream.parse_m3u8(response.text) path_to_save = "/home/joshua/Desktop/py-ffmpeg/media/index.m3u8" hls_stream.save(path_to_save) else: print("error") if __name__ == "__main__": main()

Questions about programming?Chat with your personal AI assistant