07:55
I use ffmpeg to demux and decode the media file, and then use SDL2 to play the raw data, everything is ok. no error no warning, but SDL2 windows does not dispaly video content.
All i know is frame dts is ordered in SDL2 play queue and data is good.
void VideoPlay::play_video()
while (is_running_)
refresh_loop_wait_event(&event_);
switch (event_.type)
case SDL_KEYDOWN:
if (event_.key.keysym.sym == SDLK_q)
LOG_INFO("Q quit");
is_running_ = false;
frame_queue_->abort();
break;
case SDL_QUIT:
(...)
17:27
I know video files can (and do) contain frames that are encoded out of order, which is why dts and pts exist, but can you send your frames in an arbitrary order, with their correct pts, and expect the video file to play?
Specifically I'm wondering about concatenating video files, can I decode both inputs in parallel and send the frames with the correct merged pts as they get decoded? And if so, what would the playback performance implications (...)
15:12
On ffmpeg version 7.0, using sendcmd doesn't work with instance names.
Ideally I wouldn't use the PARSED_x_filter syntax
Simple repro
ffmpeg -y -i input.mp4 -filter_complex 'cropⓐcrop_4=in_h*(9/16):in_h:0:0,sendcmd=f=sendcmd.txt' -c:v h264_videotoolbox output.mp4
Send Command File: sendcmd.txt
0 crop_4 x 0;
1 crop_4 x 10;
2 crop_4 x 20;
3 crop_4 x 30;
4 crop_4 x 40;
5 crop_4 x 50;
6 crop_4 x 60;
7 crop_4 x 70;
8 crop_4 x 80;
9 crop_4 x 90;
10 crop_4 x 100;
11 crop_4 x 110;
12 crop_4 x (...)
06:21
I am currently working on a project where I need to stream video from an RTSP source, convert it to FLV format using FFmpeg, and then send the FLV stream to clients upon request. The code I have written to achieve this is as follows:
import subprocess
from flask import Flask, Response, stream_with_context
app = Flask(__name__)
flv_header = b''
def update_stream(ffmpeg_path="ffmpeg", rtsp_url='rtsp://192.168.1.168/0', rtsp_id="rtsp01"):
global flv_header
command = [
ffmpeg_path,
'-i', rtsp_url,
(...)