playback speed of audio or video and picture in picture of a video in kivy

75 views
Skip to first unread message

Beneetta P B

unread,
Oct 6, 2022, 1:03:24 AM10/6/22
to Kivy users support
Hai,
Anyone have any sample code for playback speed in audio and video player?
2) Anyone have any idea about how to bring picture in picture out  of a video in kivy 

Elliot Garbus

unread,
Oct 6, 2022, 8:50:32 PM10/6/22
to kivy-...@googlegroups.com

FWIW I put together a small test using the pitch attribute of the created SoundLoader object, and pitch did NOT work properly with wav or mp3 files.

I suggest you raise this as an issue on the kivy GitHub: https://github.com/kivy/kivy

 

Code below.

 

import os
os.environ[
'KIVY_AUDIO'] = 'sdl2'
from kivy.app import App
from kivy.lang import Builder
from kivy.core.audio import SoundLoader
from kivy.properties import ObjectProperty


kv =
"""
BoxLayout:
    orientation: 'vertical'
    Label:
        text: 'Audio Speed Control'
    AnchorLayout:
        BoxLayout:
            size_hint: None, None
            size: 400, 48
            spacing: 4
            Button:
                text: 'Play'
                on_release: app.sound.play()
            Button:
                text: 'Stop'
                on_release: app.sound.stop() 
            
    BoxLayout:
        size_hint_y: None
        height: 100
        Slider:
            max: 20
            value: 10
            on_value:
                app.sound.pitch = self.value/10
"""


class AudioSpeedControlApp(App):
    sound = ObjectProperty()

   
def build(self):
       
return Builder.load_string(kv)

   
def on_start(self):
       
self.sound = SoundLoader.load('PinkPanther60.wav'# change to your own file


AudioSpeedControlApp().run()

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/4a9d43b2-459f-4046-9a50-06f2fcc87b50n%40googlegroups.com.

 

Elliot Garbus

unread,
Oct 6, 2022, 9:02:57 PM10/6/22
to kivy-...@googlegroups.com

This might be helpful depending on your application…

I wrote a small program for practicing guitar that plays backing tracks.  It uses ffmpeg (see: https://ffmpeg.org/) to change the speed of the audio without changing the pitch. 

Here is the repo: https://github.com/ElliotGarbus/BackingTrackPlayer

 

Here is the method that calls ffmpeg: https://github.com/ElliotGarbus/BackingTrackPlayer/blob/53cf4f9c6913916fb097d33a80f9a023a9d342ad/playscreen.py#L137

 

 

From: Beneetta P B
Sent: Wednesday, October 5, 2022 10:03 PM
To: Kivy users support
Subject: [kivy-users] playback speed of audio or video and picture in pictureof a video in kivy

 

Hai,

Anyone have any sample code for playback speed in audio and video player?

2) Anyone have any idea about how to bring picture in picture out  of a video in kivy 

--

Beneetta P B

unread,
Oct 6, 2022, 11:03:49 PM10/6/22
to kivy-...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages