Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High resolution video files (>=2160p) are extremely stuttery and slow the app #205

Open
s7uck opened this issue Apr 1, 2023 · 4 comments

Comments

@s7uck
Copy link

s7uck commented Apr 1, 2023

When trying to load a larger video file in the player with Ctrl+L, the video plays very sloppily (ie lags, frame drops, stuttering etc.) I've found that this happens on videos bigger than ~250-300 MB but the threshold will probably vary from machine to machine.

I should note that my PC is powerful enough to watch 5-6 GB 4k videos in regular mpv at a mostly constant framerate:

Schermata del 2023-04-01 10-35-02

I am using mpv as my player in gaupol, with the default command line. I tested many different files (.avi and .mp4, 30/60 fps, etc) both in gaupol and regular mpv, and there is a clear difference as regular mpv does not have any problems playing large video files. I also tried this with VLC and mplayer and the problem seems to persist.

Steps to reproduce:

  1. Open any subtitle file (.srt, .vtt, etc)
  2. Load a video file into the player (Video > Load Video... > select a large video (300-400 MB or above, any format should do)
  3. Attempt to play the video

Specs:

OS: Solus x86_64 
Host: Aspire A515-51G V2.02 
Kernel: 6.1.5-229.current 
Uptime: 40 mins 
Packages: 1220 (eopkg), 19 (flatpak) 
Shell: bash 5.1.16 
Resolution: 1366x768 
DE: GNOME 
WM: Mutter 
WM Theme: Adwaita-dark 
Theme: Adwaita [GTK2/3] 
Icons: gnome [GTK2/3] 
Terminal: gnome-terminal 
CPU: Intel i5-8250U (8) @ 3.400GHz 
GPU: NVIDIA GeForce MX150 
GPU: Intel UHD Graphics 620 
Memory: 2471MiB / 7831MiB 

Debug info:

gaupol --version: gaupol 1.11

gaupol.conf:


[application_window]
layout = HORIZONTAL
maximized = true
position = [342, 163]
show_main_toolbar = false
size = [783, 470]
# toolbar_style = ICONS

[capitalization]
# country = ""
# language = ""
# script = "Latn"

[common_error]
# classes = ["Human", "OCR"]
# country = ""
# language = ""
# script = "Latn"

[duration_adjust]
# gap = 0.0
# lengthen = true
# maximum = 6.0
# minimum = 1.5
# shorten = false
# speed = 15.0
# target = CURRENT
# use_gap = true
# use_maximum = false
# use_minimum = true

[editor]
# custom_font = "monospace"
# field_order = [NUMBER, START, END, DURATION, MAIN_TEXT, TRAN_TEXT]
# framerate = FPS_23_976
# length_unit = EM
# mode = TIME
# show_lengths_cell = true
# show_lengths_edit = true
# stretch_length = 0.05
# use_custom_font = true
# use_zebra_stripes = true
# visible_fields = [NUMBER, START, END, DURATION, MAIN_TEXT]

[encoding]
# fallback = ["utf_8", "cp1252"]
# try_auto = true
# try_locale = true
# visible = ["utf_8", "cp1252"]

[extensions]
active = ["custom-framerates"]

[extensions::custom_framerates]
# framerates = [48.0]

[file]
# align_method = POSITION
directory = "/home/user/Video/YouTube/.sottotitoli"
# encoding = "utf_8"
# format = SUBRIP
# newline = UNIX

[framerate_convert]
# target = CURRENT

[general]
# dark_theme = false
# diff_color_change = "#ffff0033"
# diff_color_delete = "#ff555533"
# diff_color_insert = "#00ff0033"
version = "1.11"

[hearing_impaired]
# country = ""
# language = ""
# script = "Latn"

[join_split_words]
# join = true
# split = false

[line_break]
# country = ""
# language = ""
# length_unit = EM
# max_length = 24
# max_lines = 3
# script = "Latn"
# skip_max_length = 24
# skip_max_lines = 3
# use_skip_max_length = true
# use_skip_max_lines = true

[position_shift]
# target = CURRENT

[position_transform]
# target = CURRENT

[preview]
custom_command = "mpv --quiet --osd-level=2 --hr-seek=yes --start=$SECONDS --sub-file=$SUBFILE --sub-codepage=utf-8 $VIDEOFILE"
# force_utf_8 = true
# offset = 1.0
# player = MPV
# use_custom_command = false

[recent]
# show_not_found = false

[search]
# fields = [MAIN_TEXT]
# ignore_case = true
# regex = false
# target = CURRENT

[spell_check]
# field = MAIN_TEXT
inline = true
# language = "en"
# size = [500, 309]
# target = CURRENT

[subtitle_insert]
# above = false

[text_assistant]
# field = MAIN_TEXT
# maximized = false
pages = ["common-error"]
# remove_blank = true
size = [763, 433]
# target = CURRENT

[video_player]
# autoplay = true
# context_length = 1.0
# line_alignment = "center"
seek_length = 10.0
# subtitle_alpha = 1.0
subtitle_background = false
# subtitle_color = "#ffffff"
subtitle_font = "Cantarell 14"
# subtitle_position_horizontal = "center"
# subtitle_position_vertical = "bottom"
# time_alpha = 1.0
# time_background = true
# time_color = "#ffffff"
# time_font = "Monospace 14"
# time_position_horizontal = "right"
# time_position_vertical = "top"
# volume = null

Unfortunately i'm not able to test this on other machines or OS right now, but I will try to investigate on whether this is my issue or a Solus issue or something else. I'll also try to look into the code to see if I can help in any way :)

@otsaloma
Copy link
Owner

otsaloma commented Apr 1, 2023

Hi, a couple thoughts on this

  • I don't see how the file size would matter. If there's a difference between files, it would be about the container (MP4, Matroska, etc.), video codec (XviD, x264, etc.) or bitrate.
  • The built-in video player in Gaupol uses GStreamer. The external video player (Tools / Preview) uses mpv, vlc or other such players. Thus you can check that you have needed GStreamer plugins installed, they are listed in the README.
  • Gaupol does use GStreamer somewhat inefficiently (see dee6b65). On my own 7 year old desktop, I can play 1080p video just fine, so it's not that bad. The benefit we get with the simple gtksink is that, unlike faster, accelerated setups, this works out of the box on different hardware and X vs. Wayland etc. in 99% of cases.
  • There's a minimal stand-alone player script in the source tree, which might help if you want to test a lot of different video: https://github.com/otsaloma/gaupol/blob/master/tools/play

Your screenshot seems to have 2160p video. I don't know if I have that high resolution at hand, but I can find something and test myself too. The bitrate isn't high though, I'm not sure if the resolution alone matters much.

@otsaloma otsaloma changed the title Large video files (> ~300MB) are extremely stuttery and slow the app High resolution video files (>=2160p) are extremely stuttery and slow the app Apr 6, 2023
@otsaloma
Copy link
Owner

otsaloma commented Apr 6, 2023

Tried it now on a 2160p 7900 kbps video file. I confirm the stuttering playback, for me it even eventually freezes completely. Using GST_DEBUG=2 gaupol I see

0:00:04.668633807 605475 0x7fa85c012460 WARN         audio-resampler audio-resampler.c:274:convert_taps_gint16_c: can't find exact taps
0:00:20.710288294 605475 0x7fa85c0eb890 WARN                   pulse pulsesink.c:704:gst_pulsering_stream_underflow_cb:<pulsesink0> Got underflow
0:00:33.649370387 605475 0x7fa85c0eb890 WARN                   pulse pulsesink.c:704:gst_pulsering_stream_underflow_cb:<pulsesink0> Got underflow
0:00:33.776172477 605475 0x7fa85c0eb890 WARN                   pulse pulsesink.c:716:gst_pulsering_stream_overflow_cb:<pulsesink0> Got overflow
0:00:33.776198960 605475 0x7fa85c0eb890 WARN                   pulse pulsesink.c:716:gst_pulsering_stream_overflow_cb:<pulsesink0> Got overflow
0:00:33.776213881 605475 0x7fa85c0eb890 WARN                   pulse pulsesink.c:716:gst_pulsering_stream_overflow_cb:<pulsesink0> Got overflow
0:00:33.776231532 605475 0x7fa85c0eb890 WARN                   pulse pulsesink.c:716:gst_pulsering_stream_overflow_cb:<pulsesink0> Got overflow
0:00:33.776248865 605475 0x7fa85c0eb890 WARN                   pulse pulsesink.c:716:gst_pulsering_stream_overflow_cb:<pulsesink0> Got overflow
0:00:33.776261598 605475 0x7fa85c0eb890 WARN                   pulse pulsesink.c:716:gst_pulsering_stream_overflow_cb:<pulsesink0> Got overflow

It would be useful if you or someone could help test whether it's the audio or video and resolution or bitrate, i.e. repack a video with and without audio, with and without video, downscale resolution keeping high bitrate, lower bitrate keeping resolution.

I'm also open to suggestions on how to setup the GStreamer pipeline differently to get better performance, but I'd still like it to work across different systems. The smallest, most conservative change would probably be some of the playbin settings (see gst-inspect-1.0 playbin).

Anyone needing a workaround, recode the video 1080p or lower (or download a different variant, whatever your source is for the video).

@s7uck
Copy link
Author

s7uck commented Apr 8, 2023

The built-in video player in Gaupol uses GStreamer. The external video player (Tools / Preview) uses mpv, vlc or other such players.

Sorry for the confusion 😅 I didn't know the difference between the F5 preview and the inline preview.

It would be useful if you or someone could help test whether it's the audio or video and resolution or bitrate, i.e. repack a video with and without audio, with and without video, downscale resolution keeping high bitrate, lower bitrate keeping resolution.

I did experience stuttering on some videos ripped from YouTube (downloaded with youtube-dl at max quality in .mp4). Most of them have ~4-5Mbps bitrates. Here's an example of the video that I originally had problems with:

image

After reducing the bitrate to ~800Kbps, the video played smoothly in Gaupol with basically no noticeable quality difference.

Maybe a solution to this would be to play back the video at a lower resolution/bitrate automatically (like a proxy in video editors). Since the size of the preview panel is pretty small, it wouldn't cause any noticeable difference and besides, given this use case, performance/framerate would be much more important than quality. The downside would probably be the added wait time before loading the video, which could vary a lot depending on the size, so it'd have to be optional. I'll see if I can test something like that

@otsaloma
Copy link
Owner

otsaloma commented Apr 8, 2023

Since the size of the preview panel is pretty small, it wouldn't cause any noticeable difference and besides, given this use case, performance/framerate would be much more important than quality. The downside would probably be the added wait time before loading the video, which could vary a lot depending on the size, so it'd have to be optional.

I agree, I think these 2160p videos are way more than needed when just subtitling. But rather than having some kind of a lengthy pre-processing step, it should really be part of the GStreamer pipeline so it's done on the fly – if possible, that is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants