Giter Club home page Giter Club logo

Comments (29)

cdguy avatar cdguy commented on September 23, 2024 1

I see. Technically we are talking about 25i don't we? I see that 25i is also known as 50i.

Anyways, sounds like a good suggestion :)

No, interlaced streams are only encoded in 50i/60i which is also equal to 25p/30p.
Let’s wait for @kingslay what he has to say, no need to speculate :)

from ksplayer.

kingslay avatar kingslay commented on September 23, 2024 1

你可以先试下用这个。
class MEOptions: KSOptions {
override func process(assetTrack: some MediaPlayerTrack) {
if assetTrack.mediaType == .video {
if [FFmpegFieldOrder.bb, .bt, .tt, .tb].contains(assetTrack.fieldOrder) {
videoFilters.append("yadif=mode=1:parity=-1:deint=1")
hardwareDecode = false
}
}
}
}

如果不够顺畅的话,那可以试下
class MEOptions: KSOptions {
override func process(assetTrack: some MediaPlayerTrack) {
if assetTrack.mediaType == .video {
if [FFmpegFieldOrder.bb, .bt, .tt, .tb].contains(assetTrack.fieldOrder) {
videoFilters.append("yadif=mode=1:parity=-1:deint=1")
videoFilters.append("fps=fps=(Int(assetTrack.nominalFrameRate*2))")
hardwareDecode = false
}
}
}

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024 1

Is this fixed now? @cdguy

@chillout23 Yes it is (almost) fixed.
It works perfectly on tvos, and on ios it needs a fine tuning.

I sent an e-mail to Kingslay about it

from ksplayer.

kingslay avatar kingslay commented on September 23, 2024 1

Is this fixed now? @cdguy

@chillout23 Yes it is (almost) fixed. It works perfectly on tvos, and on ios it needs a fine tuning.

I sent an e-mail to Kingslay about it

@cdguy 我看了下是因为在iOS preferredFramesPerSecond 不起作用,在tvOS是起作用的。还是会以60hz来刷新,但是视频是25hz。这就会导致不流畅。mpv在iOS也是流畅的吗?

from ksplayer.

kingslay avatar kingslay commented on September 23, 2024

Yadif x2 对应的ffmpeg的filter是什么呢?我这个项目是基于ffmpeg的。如果ffmpeg支持的话,那我就可以实现。

from ksplayer.

nakiostudio avatar nakiostudio commented on September 23, 2024

I believe this is how you would setup Yadif x2 in ffmpeg ffmpeg -i input.mp4 -vf "yadif=mode=1" output.mp4

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024

@nakiostudio @chillout23
In earlier versions of the demo app, when I used the function “yadif=mode=1” the live streams played in slow motion.

1- normally the yadif documentation says "yadif=1 takes true interlaced 50i footage and turns it into astonishingly high-quality 50p output"

however, the live streams are played in slow motion.

@kingslay when I check the bitratea of interlaced streams with a player like Qmplay2 I see that interlaced streams never output 50i consistently.

The bitrate varies between 45i-50i.
Besides, when I open an interlaced stream with the demo app, the demo app says that the FPS value is 25p (nothing wrong here, 50i=25p)

As you can imagine if you divide 46i to 2, it is equal to 23p

perhaps if you can find a way to double the frames per second before the stream starts (meaning that the demo app displays the FPS value as 50p) this “might” solve the issue

from ksplayer.

nakiostudio avatar nakiostudio commented on September 23, 2024

Maybe Yadif mode=0 is good enough and it doesn't slow the stream down as it doesn't double the frame rate.

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024

https://stackoverflow.com/questions/45462731/using-ffmpeg-to-change-framerate?ssp=1&darkschemeovr=1&setlang=tr-TR&safesearch=moderate

@kingslay maybe this might help

from ksplayer.

chillout23 avatar chillout23 commented on September 23, 2024

Do you guys know what kind of deinterlacer MPVLib uses? The motion is very smooth and performance is good on Apple TV. With Yadif x2 on VLC the performance is not very good on Apple TV. It is not optimized for ARM CPUs. So stuttering happens after 5 minutes as Apple TV cannot keep up with high load. However, MPV provides some similar deinterlacer which works well, but I do not know what kind of method is being used.

So if possible the logic from MPV (which is also based on ffmpeg) is what is needed to solve this - as it works well on ATV.

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024

Do you guys know what kind of deinterlacer MPVLib uses? The motion is very smooth and performance is good on Apple TV. With Yadif x2 on VLC the performance is not very good on Apple TV. It is not optimized for ARM CPUs. So stuttering happens after 5 minutes as Apple TV cannot keep up with high load. However, MPV provides some similar deinterlacer which works well, but I do not know what kind of method is being used.

So if possible the logic from MPV (which is also based on ffmpeg) is what is needed to solve this - as it works well on ATV.

@chillout23 mpv uses yadif x1

In my opinion, doubling the frames (converting the 50i stream to 50p) “might” solve the issue. Let’s wait and see

from ksplayer.

chillout23 avatar chillout23 commented on September 23, 2024

I see. Technically we are talking about 25i don't we? I see that 25i is also known as 50i.

Anyways, sounds like a good suggestion :)

from ksplayer.

kingslay avatar kingslay commented on September 23, 2024

我没有deinterlacing的本地视频。你们有人可以提供下对应的视频让我进行测试吗?

from ksplayer.

kingslay avatar kingslay commented on September 23, 2024

https://stackoverflow.com/questions/45462731/using-ffmpeg-to-change-framerate?ssp=1&darkschemeovr=1&setlang=tr-TR&safesearch=moderate

@kingslay maybe this might help

@cdguy 目前ksplayer是支持fps 这个filter。你可以加一下fps,看下视频播放会不会更流畅点。

from ksplayer.

kingslay avatar kingslay commented on September 23, 2024

Do you guys know what kind of deinterlacer MPVLib uses? The motion is very smooth and performance is good on Apple TV. With Yadif x2 on VLC the performance is not very good on Apple TV. It is not optimized for ARM CPUs. So stuttering happens after 5 minutes as Apple TV cannot keep up with high load. However, MPV provides some similar deinterlacer which works well, but I do not know what kind of method is being used.
So if possible the logic from MPV (which is also based on ffmpeg) is what is needed to solve this - as it works well on ATV.

@chillout23 mpv uses yadif x1

In my opinion, doubling the frames (converting the 50i stream to 50p) “might” solve the issue. Let’s wait and see

@cdguy
我看yadif的mode 参数值如下

mode = 0 : temporal and spatial interlacing check (default).

= 1 : double framerate (bob), temporal and spatial interlacing check.

= 2 : skips spatial interlacing check.

= 3 : double framerate (bob), skips spatial interlacing check.

你的意思是mpv用的是 mode=1 这个参数值吗?

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024

https://stackoverflow.com/questions/45462731/using-ffmpeg-to-change-framerate?ssp=1&darkschemeovr=1&setlang=tr-TR&safesearch=moderate
@kingslay maybe this might help

@cdguy 目前ksplayer是支持fps 这个filter。你可以加一下fps,看下视频播放会不会更流畅点。

@kingslay can you please write the code regarding how to double the fps value for interlaced streams?
I mean if the stream is 50i, to make it 50p; and if the stream is 60i, how to make it 60p

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024

Do you guys know what kind of deinterlacer MPVLib uses? The motion is very smooth and performance is good on Apple TV. With Yadif x2 on VLC the performance is not very good on Apple TV. It is not optimized for ARM CPUs. So stuttering happens after 5 minutes as Apple TV cannot keep up with high load. However, MPV provides some similar deinterlacer which works well, but I do not know what kind of method is being used.
So if possible the logic from MPV (which is also based on ffmpeg) is what is needed to solve this - as it works well on ATV.

@chillout23 mpv uses yadif x1
In my opinion, doubling the frames (converting the 50i stream to 50p) “might” solve the issue. Let’s wait and see

@cdguy 我看yadif的mode 参数值如下

mode = 0 : temporal and spatial interlacing check (default).

= 1 : double framerate (bob), temporal and spatial interlacing check.

= 2 : skips spatial interlacing check.

= 3 : double framerate (bob), skips spatial interlacing check.

你的意思是mpv用的是 mode=1 这个参数值吗?

@kingslay I mean, mpv uses the default yadif parameter (=0)

I just installed the desktop version of MPV. the stream I opened is an interlaced stream (50i),
the media info says that the stream is 25p.
My computer refresh rate is at 59.9 hz; because of that, you can see that the "displayed FPS" value is 59.977 FPS

image

from ksplayer.

kingslay avatar kingslay commented on September 23, 2024

@cdguy 那你换下用videoFilters.append("yadif=mode=0:parity=-1:deint=1"),看下效果怎么样。用mode=1的话,会导致cpu占用比较高。不知道是不是因为这个原因所以视频不够流畅。

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024

@kingslay

Let me express my findings:

1- Unfortunately, the last commit did not solve the "non-smooth" issue
2- if the audio codec of the interlaced stream is MP2, the sound sounds very strange
3a- when you open the same interlaced stream with MPV and KSPLAYER, without the YADIF filter, the smoothness is the same
3b- I suspect the "non smooth" issue happens when you apply the YADIF filter to KSplayer because with MPV it is smooth
4- when I used this code, the FPS value was still 25p, and the YADIF filter did not work:

class MEOptions: KSOptions {
override func process(assetTrack: some MediaPlayerTrack) {
if assetTrack.mediaType == .video {
if [FFmpegFieldOrder.bb, .bt, .tt, .tb].contains(assetTrack.fieldOrder) {
videoFilters.append("yadif=mode=0:parity=-1:deint=1")
videoFilters.append("fps=fps=(Int(assetTrack.nominalFrameRate*2))")
hardwareDecode = false

I will send you in a few minutes some links

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024

@kingslay the audio tracks encoded in MP2 still have the issue I mentioned.
You can try with the stream link I sent to you via e-mail (the one that ends with 32487)

from ksplayer.

chillout23 avatar chillout23 commented on September 23, 2024

Is this fixed now? @cdguy

from ksplayer.

kingslay avatar kingslay commented on September 23, 2024

@cdguy 可以不用加videoFilters.append("fps=fps=(Int(assetTrack.nominalFrameRate*2))")。
只要videoFilters.append("yadif=mode=0:parity=-1:deint=1") 。

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024

@kingslay I suspect this “might be” because of the refresh rate of ios devices; as some models have a refresh rate up to 120hz, whereas other ios devices have a “static” screen refresh rate of 60/90 hz

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024

我看了下是因为在iOS preferredFramesPerSecond 不起作用,在tvOS是起作用的。还是会以60hz来刷新,但是视频是25hz。这就会导致不流畅。mpv在iOS也是流畅的吗?

Yes, just check the link I sent you yesterday (that ends with 6cc3a) you will see that the video with MPV is smooth
@kingslay

from ksplayer.

kingslay avatar kingslay commented on September 23, 2024

是的,我在最新的代码增加了高刷的支持,有设备的人可以尝试下。但是我看了apple的文档 https://developer.apple.com/documentation/quartzcore/optimizing_promotion_refresh_rates_for_iphone_13_pro_and_ipad_pro 。里面没有支持25hz或50hz。所以我猜测还是会有问题。但是如果刷新率高一点的话,不流畅就不会那么明显了。

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024

Is this fixed now? @cdguy

@chillout23 Yes it is (almost) fixed. It works perfectly on tvos, and on ios it needs a fine tuning.
I sent an e-mail to Kingslay about it

@cdguy 我看了下是因为在iOS preferredFramesPerSecond 不起作用,在tvOS是起作用的。还是会以60hz来刷新,但是视频是25hz。这就会导致不流畅。mpv在iOS也是流畅的吗?

@kingslay I know it is easy to say, but if you could log and monitor the behaviour of the refresh rate in MPV lib when using an iphone (X-11-12) that has a refresh rate of 60hz; you might find something

from ksplayer.

kingslay avatar kingslay commented on September 23, 2024

我对mpv的了解很少,你知道mpv是怎么来实现视频的渲染的吗?我搜索下了下mpv的代码。里面没有用NSTimer和CADisplayLink。 我很好奇他它怎么样来实现定时渲染视频的。

from ksplayer.

cdguy avatar cdguy commented on September 23, 2024

I have sent you via e-mail a few screenshots that might help you. @kingslay

from ksplayer.

chillout23 avatar chillout23 commented on September 23, 2024

@cdguy is the motion smooth as MPV now in this KSPlayer?

from ksplayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.