cagnulein / qdomyos-zwift

Zwift bridge for smart treadmills and bike/cyclette
https://www.qzfitness.com/
GNU General Public License v3.0
416 stars 116 forks source link

QmlVLC in order to improve video playbackrate #981

Open cagnulein opened 2 years ago

cagnulein commented 2 years ago

https://github.com/RSATom/QmlVlc?fbclid=IwAR3BIcl0Z9E3zKTWZtDLUhcLGZipi56GdIKj5ft-yOV_RiQ5dMo-rROoXN4 @Bepo7012

cagnulein commented 2 years ago

better https://videojs.com/

Bepo7012 commented 2 years ago

Even more better: HTML5. Everything should be possible:

<!DOCTYPE html> 
<html> 
<body> 

<button onclick="getPlaySpeed()" type="button">What is the playback speed?</button>
<button onclick="getPosition()" type="button">Get Time</button>
<button onclick="setPosition()" type="button">Set Time+2</button>
<button onclick="setPlaySpeedSlower()" type="button">Slower</button>
<button onclick="setPlaySpeedFaster()" type="button">Faster</button>
<button onclick="setPlaySpeedFasterFine()" type="button">Faster fine</button>
<button onclick="setPlaySpeedSlowerFine()" type="button">Slower fine</button><br> 

<video id="myVideo" width="1024" height="768" controls muted>
  <source src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" type="video/mp4">
  Your browser does not support HTML5 video.
</video>

<script>
var vid = document.getElementById("myVideo");

function getPlaySpeed() { 
  alert(vid.playbackRate);
} 

function getPosition() { 
  alert(vid.currentTime);
} 

function setPosition() { 
  vid.currentTime = vid.currentTime+2.0;
} 

function setPlaySpeedSlower() { 
  vid.playbackRate = vid.playbackRate-0.5;
} 
function setPlaySpeedFaster() { 
  vid.playbackRate = vid.playbackRate+0.5;
} 
function setPlaySpeedSlowerFine() { 
  vid.playbackRate = vid.playbackRate-0.1;
} 
function setPlaySpeedFasterFine() { 
  vid.playbackRate = vid.playbackRate+0.1;
} 
</script> 

</body> 
</html>
cagnulein commented 2 years ago

@Bepo7012 i actually built without issues the https://github.com/cagnulein/QmlVlc in this repo there is also the speed method, so we are good to go.

this is the ios kit for vlc https://github.com/videolan/vlckit android one https://github.com/masterwok/libvlc-android-sdk

do you find something about speedrate on iOS via HTML?

cagnulein commented 2 years ago

@Bepo7012 another good library https://github.com/wang-bin/QtAV probably easiest to use

cagnulein commented 2 years ago

I opened a bug on the videojs project https://github.com/videojs/video.js/issues/7961

Bepo7012 commented 2 years ago

What I found about html on iOS, or better, on every mobile device ( so on android too) is, that all browsers on these devices always do a streaming and not playing of videos because of saving data usage. And with streaming the possible speed rates are naturally limited because there is not enough buffer to use. Convincing the browser to do a video play on mobile devices is not easily done, the only reliable way would be a kind of buffering between source and video renderer (what jwplayer also do) but I heave not investigated how this task can be accomplished.


Von: Roberto Viola @.> Gesendet: Friday, October 14, 2022 8:40:16 AM An: cagnulein/qdomyos-zwift @.> Cc: Bepo7012 @.>; Mention @.> Betreff: Re: [cagnulein/qdomyos-zwift] QmlVLC in order to improve video playbackrate (Issue #981)

@Bepo7012https://github.com/Bepo7012 i actually built without issues the https://github.com/cagnulein/QmlVlc in this repo there is also the speed method, so we are good to go.

this is the ios kit for vlc https://github.com/videolan/vlckit

do you find something about speedrate on iOS via HTML?

— Reply to this email directly, view it on GitHubhttps://github.com/cagnulein/qdomyos-zwift/issues/981#issuecomment-1278552261, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWDBIKEWT7PMNJ2STS64ITTWDD55BANCNFSM6AAAAAAREJCEZY. You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 2 years ago

HTML5 locally https://stackoverflow.com/questions/8885701/play-local-hard-drive-video-file-with-html5-video-tag ?

Bepo7012 commented 2 years ago

Same effect, playing locally works on iOS only until factor 2 then the video is displayed "jumpy"

cagnulein commented 2 years ago

So i guess native library it's the only way to go. This is very disappointing

Bepo7012 commented 2 years ago

So i guess native library it's the only way to go. This is very disappointing

yes, if we can't get some kind of buffering managed :-(

@Bepo7012 another good library https://github.com/wang-bin/QtAV probably easiest to use

as far as i can estimate it (too less experince with libraries) it looks promising too

Bepo7012 commented 2 years ago

Yeah, have a working sample with Video.js :-) Will do some test's and post it here

cagnulein commented 2 years ago

you dropped the bomb!

Bepo7012 commented 2 years ago

As usual i was happy a little bit to early ;-) But it seem's that we are getting closer. In the sample i used there was a m3u8 playlist used which worked perfectly, but as soon as i switched over to my mp4 file again the Issue reappeared. So it seem's we can't use mp4 files for this purpose, i'm just searching which file-types can be played smoothly. Do you think it's a problem not to use mp4's?

cagnulein commented 2 years ago

if the playlist works, i think there is no problem at all since we can incapsulate it in the js.

Bepo7012 commented 2 years ago

Unfortunately it seem's it is not only an incapsulation of the file. I have tried this resulting in a very long loading time of the video. It seem's that we need a possibilty to split the .mp4 to many small .ts files and encapsulate this ts files into a m3u8 playlist, exactly the format that our "Source" is doing it ;-)

Bepo7012 commented 2 years ago

@cagnulein Working now on Windows, new iPad and old iPad via a local Webserver :-) . Can you test it on MacOS and also locally on the iPad? Just use this

test.zip

html file, there are buttons for all needed functionality on it. To get the Video use the following:

ffmpeg.exe -i {url to source m3u8} -map 0 -c copy -f segment -segment_list test.m3u8 -segment_time 18 test_%03d.ts

This downloads the video completely, splits it in parts of about 18 seconds (same as i have seen on the "source") and write the needed m3u8 file. Don't forget to change the source url in the html an look what happens. I keep my fingers crossed

cagnulein commented 2 years ago

Wow! I'm out actually but I will try this tomorrow!

Bepo7012 commented 2 years ago

@cagnulein Hmm, played around with the possibility of playing this HLS Videos locally, but it seem's not to be possible. Isn't a small Webserver already implemented too?

cagnulein commented 2 years ago

@cagnulein Hmm, played around with the possibility of playing this HLS Videos locally, but it seem's not to be possible. Isn't a small Webserver already implemented too?

yes it is! I didn't the time yet to check your yesterday's implementation

Bepo7012 commented 2 years ago

No problem at all, just good to know that there would be a solution for playing the files locally too :-)

Bepo7012 commented 2 years ago

@cagnulein Here now the correct Zip

test.zip

Bepo7012 commented 2 years ago

@cagnulein If you like to try it with dash.js here it is:

testdashjs.zip

This i have used to convert the mp4 to the needed .mpd structure:

ffmpeg -i {mp4 File} -vcodec copy -acodec copy test.mpd

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

cagnulein commented 2 years ago

yes bot, you're right, i'm lazy :)

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

cagnulein commented 1 year ago

@Bepo7012 https://www.qt.io/blog/ffmpeg-android?utm_campaign=Newsletters%202023&utm_medium=email&_hsmi=268405691&_hsenc=p2ANqtz-8KnZpwgyQfY7LNFBvnwJLlwiQ6dxjrFL95isrM2enrt5nlyptAEXQR-GNa8OOZHvHKhJCticnA-ZyQiWe8X-HizUtQmQ&utm_content=268405691&utm_source=hs_email

maybe I can check if it's portable to Qt5 in the future, not an easy job for sure.

Bepo7012 commented 1 year ago

@cagnulein I assume a quite hard Job. I think we need a little more Feedback if the current way of double speeding the recorded Video and limit the players speed to the max playback rate possible is useable for the Users. This way the Variant with an HTML player would be the much more easier solution.

Bepo7012 commented 1 year ago

@cagnulein And BTW: Will upload a few more Videos maybe today or tomorrow