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)

log.txt (7.3 KB ) - added by MB SOFT 7 months ago.

Download all attachments as: .zip

Change History (8)

by MB SOFT, 7 months ago

Attachment: log.txt added

comment:1 by MB SOFT, 7 months ago

i would add that 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 fine on ffmpeg 5 and freeze in all ffmpeg 6 versions

and this commandline

ffplay.exe -loglevel debug -f lavfi -i "testsrc=size=1280x720"

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

comment:2 by MB SOFT, 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:

https://www.mbradio.it/service/20231111_214708.mp4

comment:3 by quinkblack, 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.

comment:4 by MB SOFT, 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

Last edited 6 months ago by MB SOFT (previous) (diff)

in reply to:  4 comment:5 by quinkblack, 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 MB SOFT, 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

Note: See TracTickets for help on using tickets.