I wanna download an only-audio video from YouTube and then convert it into mp3 format using ffmpegio and I wanna save everything into buffers so I met the issue.
What should happen: save ffmpeg output to byio (BytesIO) What happens: console error
from pytube import YouTube
from io import BytesIO
import ffmpegio
yt = YouTube("link")
byio = BytesIO()
stream = yt.streams.get_audio_only()
stream.stream_to_buffer(byio)
ffmpegio.transcode(byio.getbuffer(), byio, overwrite=True) # i dont know how to make it write as byio mp3 or something
byio.seek(1)
CONSOLE OUTPUT:
"stdout": stdout,
UnboundLocalError: local variable 'stdout' referenced before assignment