basic streaming to icecast
This commit is contained in:
		
							parent
							
								
									7c318896be
								
							
						
					
					
						commit
						f398cc448b
					
				| @ -4,5 +4,5 @@ pkgs.python3Packages.buildPythonApplication { | |||||||
|   pname = "radio"; |   pname = "radio"; | ||||||
|   src = self; |   src = self; | ||||||
|   version = "0.1"; |   version = "0.1"; | ||||||
|   propagatedBuildInputs = with pkgs.python3Packages; [ pip ffmpeg-python youtube-dl ]; |   propagatedBuildInputs = with pkgs.python3Packages; [ pip ffmpeg-python ]; | ||||||
| } | } | ||||||
| @ -31,7 +31,7 @@ def executeYoutubeDL(url, cb): | |||||||
|     "-o", "-", |     "-o", "-", | ||||||
|     "-f", "bestaudio/best", |     "-f", "bestaudio/best", | ||||||
|     # "--extract-audio", |     # "--extract-audio", | ||||||
|     "--audio-format", "wav", |     "--audio-format", "mp3", | ||||||
|     "--prefer-ffmpeg", |     "--prefer-ffmpeg", | ||||||
|     #"--postprocessor-args", "-re", |     #"--postprocessor-args", "-re", | ||||||
|     #"--external-downloader", "ffmpeg", |     #"--external-downloader", "ffmpeg", | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								radio.py
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								radio.py
									
									
									
									
									
								
							| @ -3,20 +3,18 @@ import ffmpeg | |||||||
| import sys | import sys | ||||||
| 
 | 
 | ||||||
| def run(): | def run(): | ||||||
|   # process = ( |   process = ( ffmpeg | ||||||
|   #   ffmpeg |     .input('pipe:', re=None) | ||||||
|   #   .input('pipe:', format='wav') |     .output("icecast://source:hackme@localhost:8000/stream.mp3", format='mp3', content_type="audio/mpeg") | ||||||
|   #   .output("icecast://source:hackme@localhost:8000/stream.mp3", format='mp3', content_type="audio/mpeg") |     .run_async(pipe_stdin=True) | ||||||
|   #   .global_args("-re") # argument to act as a live stream |   ) | ||||||
|   #   .run_async(pipe_stdin=True) |  | ||||||
|   # ) |  | ||||||
| 
 | 
 | ||||||
|   def cb(chunk): |   def cb(chunk): | ||||||
|     # process.stdin.write(chunk) |     process.stdin.write(chunk) | ||||||
|     sys.stdout.write("".join(map(chr, chunk))) |  | ||||||
|     return False |     return False | ||||||
| 
 | 
 | ||||||
|   downloader.download('https://www.youtube.com/watch?v=BaW_jenozKc', cb) |   downloader.download('https://www.youtube.com/watch?v=EbnH3VHzhu8', cb) | ||||||
|  |   # downloader.download('https://www.youtube.com/watch?v=BaW_jenozKc', cb) | ||||||
|   # downloader.download('https://www.youtube.com/watch?v=kgBcg4uBd9Q', cb) |   # downloader.download('https://www.youtube.com/watch?v=kgBcg4uBd9Q', cb) | ||||||
|   # downloader.download('https://www.youtube.com/watch?v=EbnH3VHzhu8', cb) |   # downloader.download('https://www.youtube.com/watch?v=EbnH3VHzhu8', cb) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user