21:12
I'm decoding video PES packets (packetized elementary stream) containing H.264/AVC and H.265/HEVC using libavcodec like this:
while (remainingESBytes > 0)
int bytesUsed = av_parser_parse2(
mpParser, mpDecContext,
&mpEncPacket->data, &mpEncPacket->size,
pIn, remainingESBytes,
AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
// send encoded packet for decoding
int ret = avcodec_send_packet(mpDecContext, mpEncPacket);
if (ret < 0)
// failed
continue;
while (ret >= 0)
ret = (...)
14:35
My discord music bot based on discord.py, yt_dlp and ffmpeg is not working.
I downloaded every module that is required and added environmental variables.
But, my discord bot is not working properly.
The bot plays the music properly at first, but the music ends before the song finishes.
Full code below:
import discord
from discord.ext import commands
import yt_dlp
app = commands.Bot(command_prefix='!', intents=discord.Intents.all())
ydl_opts =
'format': 'bestaudio/best',
'extractaudio': True,
(...)
15:03
I have an aiortc app, which html5 client send data (microphone,camera) into server.
In server side i sucessfully played this two streams seperatly.
But when i try to record using aiortc MediaRecorder helper class, only the voice is recording, and the video is dropped (mp4 format).
I think this is due sync issue.
The audio_frame and the video_frame (each pair of them) have different time_base.
(I don't know if this is strange).
But it also has different time.
I can share code, but couldn't help at all right now.
Edit: I also tried to (...)
01:21
I need to play two videos in real time in Python.
One video is a background video with no alpha channel. I am using H264 but it can be any codec.
The second video is an overlay video. This video with an alpha channel needs to be played in real-time on top of the first video. I am using Quicktime 444 with an alpha channel but again, it can be any codec.
In terms of libraries, I tried a combination of cv and numpy, I tried pymovie, pyAV, ffmpeg... so far, all the results have been unsuccessful. When the videos render, the frame rate drops way below 30FPS, and the resulting (...)
10:41
I need to play two videos with synched sound in real-time with Pygame.
Pygame does not currently support video streams, so I am using a ffmpeg subprocess.
The first video is a prores422_hq. This is a background video with no alpha channel.
The second video is a prores4444 overlay video with an alpha channel, and it needs to be played in real-tim on top of the first video (with transparency).
All of this needs synched sound from the first base video only.
I have tried many libraries, including pymovie pyav and opencv. The best result so far is to use a subprocess with (...)
09:51
I need to play two videos with synched sound in real-time with Pygame.
Pygame does not currently support video streams, so I am using a ffmpeg subprocess.
The first video is a prores422_hq. This is a background video with no alpha channel.
The second video is a prores4444 overlay video with an alpha channel, and it needs to be played in real-tim on top of the first video (with transparency).
All of this needs synched sound from the first base video only.
I have tried many libraries, including pymovie pyav and opencv. The best result so far is to use a subprocess with (...)
05:49
When the button is clicked, I create 16 threads in Qt, and then pass the rtsp data address and the label to be rendered to the process, and then the process does this:
run:
void rtspthread::run()
while(!shouldStop)
openRtspStream(rtspUrl.toUtf8().constData(),index);
qDebug() << "RTSP stream stopped.";
emit finished();
open input stream:
void rtspthread::openRtspStream(const char* rtspUrl,int index)
AVDictionary *options = nullptr;
AVFrame *pFrameRGB = nullptr;
uint8_t (...)