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

Help setting video/audio filters for MediaPlayer using lib_opts #148

Open
blsqr opened this issue Aug 16, 2023 · 2 comments
Open

Help setting video/audio filters for MediaPlayer using lib_opts #148

blsqr opened this issue Aug 16, 2023 · 2 comments

Comments

@blsqr
Copy link

blsqr commented Aug 16, 2023

Hi there,

I'm looking for some help regarding the syntax to set video and/or audio filters in MediaPlayer (where I'm trying to speed up a video).
The following ffplay command with video/audio filters works as expected:

ffplay -i video.mp4 -vf "[in]setpts=0.5*PTS[out]" -af "[in]atempo=2.0[out]"

I translated this into lib_opts as follows:

lib_opts = {
    "-vf": "[in]setpts=0.5*PTS[out]",
    "-af": "[in]atempo=2.0[out]",
}
ff_opts = {
    "sync": "audio",
    "paused": False,
    "ss": 0,  # seek to start
    "infbuf": False,
}

player = MediaPlayer(
    video_url, lib_opts=lib_opts, ff_opts=ff_opts
)

… but get the error: library option -vf: b'[in]setpts=0.5*PTS[out]' not found. The same happens with vf/af.

Are audio/video filters supported by MediaPlayer? If so, how can I pass these options correctly?

@blsqr blsqr changed the title Help setting MediaPlayer filters via lib_opts Help setting video/audio filters for MediaPlayer using lib_opts Aug 16, 2023
@truubo
Copy link

truubo commented Jan 12, 2025

Very late response, I know, but I found out that you have to set video filters in ff_opts.

ff_opts = {
    "fps": 8
}

MediaPlayer(video_url, ff_opts=ff_opts)

Just posting this in case someone has the same headache I was going through.

@blsqr
Copy link
Author

blsqr commented Jan 13, 2025

Thank you, I wasn't aware that fps is a valid option in ff_opts! However, this fps setting seems to be ignored, both with sync: audio and without. I will test again in a more isolated setting, though.

Which version of ffpyplayer and ffmpeg are you using?

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