qdomyos-zwift icon indicating copy to clipboard operation
qdomyos-zwift copied to clipboard

Video again, just to show and see

Open jonathancolledge opened this issue 2 years ago • 167 comments

Hi Roberto,

Following from my previous, here is a video and accompanying GPX file. Don't play the video in Onedrive, it'll look terrible! It needs downloading.

If you play it in a player and put it on repeat, go near the end and it should transition smoothly back to the start and you'll know what I mean about laps.

What I envision is you load a GPX file and instead of clicking on the map button, you click on the video play.

This video can run in a loop, so a unique feature that no other app can do would be to enable loops/laps - the key thing would be that when you get to the last point in the GPX file you then run instantly from the first point (so there is no stutter). Here the last point and first point are 70 cm apart, but they should be at the same spot (that is easy to fix, but I don't think necessary if you get to the last point and immediately begin again at the first rather than travel to the first point, if you see what I mean?). That'd probably need a toggle option for loop as not everyone would like to do continuous laps, I suppose.

This video was filmed on my bike. I have others filmed on a car, but not ready yet. There are advantages to both. Here I have focussed on the transition from finish to start to enable multiple laps.

It is in h.265 format as that will likely be the best balance of storage space, compatibility, and quality, but if compatibility is difficult, I can send h.264. I also have it in 4k, but the video is big.

For simplicity, the GPX is at 1-second intervals. Elevation data have been taken from LiDAR, which is accurate to a few centimetres (better than barometric and Strava)

I have tested it on Golden Cheetah.

Do try running the video on repeat and see what you think. Do you think it is a goer? If so, I can supply more videos. Not sure how they could be hosted and downloaded yet.

Video: https://1drv.ms/v/s!Atx8lntMOSfZkMl6I7VrLdbU9Z4NYQ?e=kYZj04

GPX file: https://1drv.ms/u/s!Atx8lntMOSfZkMl7MmA5M3dY_wn2hQ?e=jJU1BK

Screenshot on Golden Cheetah (I don't like the map, just like the video, I think, maybe some people might like a map, but it would get in the way of the video) https://1drv.ms/u/s!Atx8lntMOSfZkMoAFAIfGCRWv37Wow?e=dMGPmV

jonathancolledge avatar Jun 18 '22 06:06 jonathancolledge

very exciting!

a couple of questions:

  1. video should be slowed or fasted in sync with the speed of the player isn't it?
  2. who can provide this video for free? I mean the majority of the users want just to play something not to record a real ride first:) Do you know if there are some youtube channels with also gpx?
  3. so you will prefer this kind of videos instead of 3d maps?

cagnulein avatar Jun 18 '22 06:06 cagnulein

  1. Yes video speed depends on speed from power and the original GPX tells you how fast the bike was going when the video was recording, so you know how much to change the video speed. 2a. I can provide some videos. I'm very slow and not as quick at things as you, but I can do a few. 2b. Hosting wise, not sure. I might be able to host some, but not sure of the traffic volume. Ideally users should be able to download and use them locally. 2c. YouTube has an API that can change speed, but I'm not sure how reliable that would be. That would mean YouTube hosting might work. But playing from a local file seems best to start as that'll never break
  2. No, I think it would be a great addition. My comment was just regarding Golden Cheetah's way of doing it. I just don't like to always have the map overlying the video. Map functionality is best as it'll always work without a video.

jonathancolledge avatar Jun 18 '22 07:06 jonathancolledge

Ah, actually the adverts ruin the YouTube idea ☹️

jonathancolledge avatar Jun 18 '22 07:06 jonathancolledge

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.

stale[bot] avatar Jul 03 '22 10:07 stale[bot]

I would like to have similar feature like in Kinomap. I recorded a video and GPS for Kinomap app some time ago. Look here. https://videos.kinomap.com/en/watch/xw4cvy But the problem is you can't run even your own videos without a subsription ( i use theradmill only on bad weather). A long time ago I wrote some code in visal basic for my spinner bike (I use magnet that activate right press key on Mouse and video plays faster or slower). I used VLC player api, that can play video on diferent speed (no GPS then).

zagor256 avatar Jul 27 '22 14:07 zagor256

yeah it's totally doable @zagor256 I just need time to do it. As @jonathancolledge suggested, we can create a google drive folder or something with our videos and gpx. Are you a coder @zagor256 ?

cagnulein avatar Jul 27 '22 15:07 cagnulein

@jonathancolledge @zagor256 i'm thinking about speed sync. So probably the best way is using the actual GPX function on QZ so everything about speed and power is already manage. So let's say that i know every seconds (or also with better precision) where I am in the GPX file. In the gpx file, I guess, the elapsed matches the elasped of the video, so every seconds or so i have to check if i'm too forward or back, and slow down the speed or viceversa... Of course the increments/decrements should be smooth, so I have to do a sort of "following mechanism" in order to prioritize the smoothness of the video.

What do you think?

cagnulein avatar Jul 27 '22 15:07 cagnulein

also @zagor256 in the meantime, you can try to use the GPX and 3d map function in QZ. I'm using it for my indoor session as you do for your video and I don't miss the video of my session :)

cagnulein avatar Jul 27 '22 15:07 cagnulein

I'm not a coder. Just some visual basic and python. In Kinomap I uploaded gpx frow watch and video and then I can trim at the end of gpx to fit perfectly. It will also smootly auto incline when i run. Yes I will try 3d map.

zagor256 avatar Jul 27 '22 18:07 zagor256

ok i'm starting a simple branch to check the feasibility of this. My idea is, when you load a GPX file, i'm trying to see if in the same path there is a mp4 with the same name. If so, I will add a new icon in the right top corner showing the playback screen (next to the 3d map). I will tell you when I will be ready to test it

cagnulein avatar Jul 28 '22 08:07 cagnulein

ok, video playback already works. For windows remember that you need to install https://codecguide.com/download_kl.htm

cagnulein avatar Jul 28 '22 09:07 cagnulein

ok guys, Done! check #875 Everything already works! With just 1 hour of work! So this is what's happening:

  • You need to place the gpx and the mp4 on the same folder. Both files should have the same name, except the extension.
  • Connect your device
  • Open the GPX file from QZ
  • Press start
  • You will see the new movie icon on the right corner
  • Click on it and the video will playback from the current position with the right playback ratio!

Open point:

  • at least on windows, everytime I changed the playbackratio due to different speed, i saw for a moment a white screen. It's releated to an open qt bug that could be solved with this library https://www.qtav.org/ ; i don't know if this bug affects also mac, ios or android and linux
  • video should be in a window or half size of the screen in order to see also the metrics
  • i would like to open video from internet instead of using the local media. maybe putting the video url in a gpx tag?

Let me know your thoughts! I will try to run this on my Mac Air M1 tomorrow

cagnulein avatar Jul 28 '22 10:07 cagnulein

@zagor256 can you share that video and gpx here so I can use as an example on my test?

cagnulein avatar Jul 28 '22 15:07 cagnulein

No problem

gpx: https://drive.google.com/file/d/1FtOnTJk1ORSJG-KGhcOxKvl65WgISPVl/view?usp=sharing

video: https://drive.google.com/file/d/1Yv0Wi7ciTb4QfDw_gOEaHrFbL38r8kll/view?usp=sharing

zagor256 avatar Jul 28 '22 17:07 zagor256

I built your code with my mac (non M1). I do see camera icon but when I press on the screen is white. I may do something wrong because I also have occosionaly some crash regarding to bluetooth and 3d maps button doesnt work also (I'm not very skilled also ;) )

zagor256 avatar Jul 29 '22 07:07 zagor256

@zagor256 i didn't test yet with my M1. Do you have a debug log so I can check that the playback is working?

cagnulein avatar Jul 29 '22 07:07 cagnulein

@zagor256 same here: error defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer" 2022-07-29 10:11:51.460550+0200 qdomyoszwift[91746:9653916] defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"

I'm trying to fix it.

for the 3dmaps you need to define your own cesium key in the cesium-key.js file

cagnulein avatar Jul 29 '22 08:07 cagnulein

https://bugreports.qt.io/browse/QTBUG-35304 iOS issue solving with this one

cagnulein avatar Jul 29 '22 08:07 cagnulein

I just want to ask where to find debug log file :) But you have similar result.

zagor256 avatar Jul 29 '22 08:07 zagor256

yes let me fixing and I will push the modifications ;)

cagnulein avatar Jul 29 '22 08:07 cagnulein

in the meantime @jonathancolledge i found this https://github.com/elunico/custom-youtube-speed that will allow us to change the playback speed on youtobe video!

cagnulein avatar Jul 29 '22 08:07 cagnulein

also using a drive folder or similar we can use this JS code https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playbackRate

cagnulein avatar Jul 29 '22 10:07 cagnulein

@zagor256 fixed! pull the new modification from the pull request! I guess I can try to build an iOS beta if you want to try it also on your ipad for example

cagnulein avatar Jul 29 '22 11:07 cagnulein

perfect! I found the way to play the file from google drive with this! https://www.googleapis.com/drive/v3/files/{file id}?alt=media&key={drive api key}

cagnulein avatar Jul 29 '22 12:07 cagnulein

I don't have subscription for Kinomap anymore but if anyone has it the videos and GPS files can be downloaded for testing purposec in qdomyos (only gps track can be downloaded without). https://support.kinomap.com/hc/en-us/articles/212102403-Is-it-possible-to-download-a-video-from-Kinomap-

zagor256 avatar Jul 29 '22 12:07 zagor256

@zagor256 it's not a good idea to use the video copyrighted by kinomap. Or at least not in public ;) that's why i'm encouraging you and the other users to upload your own video ;)

cagnulein avatar Jul 29 '22 12:07 cagnulein

Now video works also on my intel mac. And those horror sounds should be muted :)

zagor256 avatar Jul 29 '22 13:07 zagor256

hahaha sure :D did you try a small run?

cagnulein avatar Jul 29 '22 14:07 cagnulein

ok i'm ready to merge the branch. I did the last modification, I handled a new metadata value in the gpx for the video url

check the video tag here

<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" creator="Polar V650" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
	<metadata>
		<name>Test ride </name>
		<desc>test ride </desc>
                <video>http://whateveryouwant.com/filevideo.mp4</video>
	</metadata>
	<trk>
		<name>Test ride </name>
		<number>1</number>
		<trkseg>
<trkpt lat="54.21753833" lon="18.12054833"><ele>275.0</ele><time>2022-07-30T09:41:20.221Z</time></trkpt>
<trkpt lat="54.21753833" lon="18.12054833"><ele>275.0</ele><time>2022-07-30T09:41:21.217Z</time></trkpt>

@zagor256 @jonathancolledge what do you think?

cagnulein avatar Aug 01 '22 06:08 cagnulein

My problem. After compile an app it starts normaly. But next starts causes crash after bluetooth connection . Here is log of crash.

debug log: debug-Mon_Aug_1_10_55_38_2022.log

zagor256 avatar Aug 01 '22 08:08 zagor256