Opened 7 months ago
Last modified 5 months ago
#10625 new defect
SDL output freeze
Reported by: | MB SOFT | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | sdl |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug: when using SDL output the window freeze after few seconds
How to reproduce:
% ffmpeg.exe -loglevel debug -f lavfi -i "testsrc=size=1280x720" -c:v rawvideo -pix_fmt yuv420p -window_enable_quit 0 -window_size 455x256 -f sdl "Test" ffmpeg version N-112467-g5ddab49d48-20231017 built on ...20231017
Attachments (1)
Change History (8)
by , 7 months ago
comment:1 by , 7 months ago
comment:2 by , 6 months ago
update: on ffmpeg version N-112730-gfa81de4af0-20231111 the commandline:
ffmpeg.exe -loglevel debug -f lavfi -i "testsrc=size=1280x720" -c:v rawvideo -pix_fmt yuv420p -window_enable_quit 0 -window_size 455x256 -f sdl "Test"
works until you click inside the sdl windows ... at that point the window freeze
i guess you forgot to process win32 api messages in the sdl window
here a video that show the problem:
comment:3 by , 6 months ago
The reason is SDL should be run in main thread, now it's created in one thread and used in another thread.
It's a very specific case for current ffmpeg cmdline multithreads refactor. I don't see a simple way to fix this than some big refactor again.
I can only provide a workaround method: pipe ffmpeg output to ffplay.
follow-up: 5 comment:4 by , 6 months ago
thank yo for the explanation.
indeed there was the same problem 10 years ago http://trac.ffmpeg.org/ticket/1744
it was fixed but the changes in ffmpeg 6 reintroduced the problem.
hope someone will fix it again
pipe to ffplay introduce latency, sdl was good for the low latency.
if no one will fix it i'll switch this task to gstreamer
comment:5 by , 6 months ago
Replying to MB SOFT:
thank yo for the explanation.
indeed there was the same problem 10 years ago http://trac.ffmpeg.org/ticket/1744
it was fixed but the changes in ffmpeg 6 reintroduced the problem.
hope someone will fix it again
pipe to ffplay introduce latency, sdl was good for the low latency.
why not use ffplay directly:
ffplay -f lavfi -i "testsrc=size=1280x720"
comment:6 by , 6 months ago
because i'm encoding and displaying at the same time, i cannot encode with ffplay and the sdl display of ffmpeg is broken (on windows)
ffmpeg.exe -f dshow -video_size 1280x720 -i video="Full HD 1080P PC Camera" -vcodec libx264 -x264-params nal-hrd=cbr:force-cfr=1:keyint=60 -preset superfast -profile high -pix_fmt yuv420p -tune zerolatency -b:v 1024K -f mpegts "srt://192.168.1.201:9896?pkt_size=1316&transtype=live" -c:v rawvideo -pix_fmt yuv420p -window_enable_quit 0 -window_size 441x248 -vf setpts=0 -f sdl
comment:7 by , 5 months ago
you can try this patch https://patchwork.ffmpeg.org/project/ffmpeg/patch/20231101090115.10655-1-angus.chen@intel.com/
but it is not accepted by community.
i would add that the commandline
works fine on ffmpeg 5 and freeze in all ffmpeg 6 versions
and this commandline
works fine on all ffplay version.
so there is for sure a bug in ffmpeg 6 sdl output
i'm still using ffmpeg 5 until it's fixed