Skip to content

Commit 8f1faa6

Browse files
author
kanehekili
committed
V3.0.3 MPV 0.39 fix
1 parent 8a70c42 commit 8f1faa6

File tree

6 files changed

+2210
-14
lines changed

6 files changed

+2210
-14
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# VideoCut
2-
Version 3.0.2
2+
Version 3.0.3
33

4-
![Download](https://github.com/kanehekili/VideoCut/releases/download/3.0.2/videocut3.0.2.tar)
4+
![Download](https://github.com/kanehekili/VideoCut/releases/download/3.0.3/videocut3.0.3.tar)
55

66
MP2/MP4 Cutter for Linux on base of mpv and ffmpeg. Cutting is lossless, the target file will not be reencoded.
77

@@ -176,8 +176,11 @@ Copy the .desktop file and change the exec line to "Exec= python3 .../VideoCut.p
176176
Opencv will not be displaying subtitles nor frametypes.
177177

178178
### Changes
179+
22.09.24
180+
* mpv 0.39 fps property switch (Corubba again. Thanks a lot)
181+
179182
13.07.24
180-
* mpv 1.0.7
183+
* mpv bindings 1.0.7
181184
* support ffmpeg V7 (Courtesy of Corubba)
182185

183186
12.05.2024

build/build.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
version=3.0.2
1+
version=3.0.3
22
ubu0=focal
33
ubu1=jammy
44
ubu2=noble
5-
pkgrelease=3
5+
pkgrelease=1

src/VideoCut.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
3-
# copyright (c) 2022 kanehekili (mat.wegmann@gmail.com)
3+
# copyright (c) 2016-2024 kanehekili (kanehekili.media@gmail.com)
44
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License,
55
# as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
66
# later version.

src/ffmpeg/src/remux5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* MPEG/H264 muxer/cutter/trancoder
3-
* Copyright (c) 2018-2021 Kanehekili
3+
* Copyright (c) 2018-2024 Kanehekili
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining a copy
66
* of this software and associated documentation files (the "Software"), to deal

src/lib/mpv.py

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# vim: ts=4 sw=4 et
33
#
44
# Python MPV library module
5-
# Copyright (C) 2017-2022 Sebastian Götte <code@jaseg.net>
5+
# Copyright (C) 2017-2024 Sebastian Götte <code@jaseg.net>
66
#
77
# python-mpv inherits the underlying libmpv's license, which can be either GPLv2 or later (default) or LGPLv2.1 or
88
# later. For details, see the mpv copyright page here: https://github.com/mpv-player/mpv/blob/master/Copyright
@@ -24,6 +24,7 @@
2424
import threading
2525
import queue
2626
import os
27+
import os.path
2728
import sys
2829
from warnings import warn
2930
from functools import partial, wraps
@@ -35,11 +36,30 @@
3536

3637
if os.name == 'nt':
3738
# Note: mpv-2.dll with API version 2 corresponds to mpv v0.35.0. Most things should work with the fallback, too.
38-
dll = ctypes.util.find_library('mpv-2.dll') or ctypes.util.find_library('libmpv-2.dll') or ctypes.util.find_library('mpv-1.dll')
39-
if dll is None:
40-
raise OSError('Cannot find mpv-1.dll, mpv-2.dll or libmpv-2.dll in your system %PATH%. One way to deal with this is to ship the dll with your script and put the directory your script is in into %PATH% before "import mpv": os.environ["PATH"] = os.path.dirname(__file__) + os.pathsep + os.environ["PATH"] If mpv-1.dll is located elsewhere, you can add that path to os.environ["PATH"].')
41-
backend = CDLL(dll)
39+
names = ['mpv-2.dll', 'libmpv-2.dll', 'mpv-1.dll']
40+
for name in names:
41+
dll = ctypes.util.find_library(name)
42+
if dll:
43+
break
44+
else:
45+
for name in names:
46+
dll = os.path.join(os.path.dirname(__file__), name)
47+
if os.path.isfile(dll):
48+
break
49+
else:
50+
raise OSError('Cannot find mpv-1.dll, mpv-2.dll or libmpv-2.dll in your system %PATH%. One way to deal with this is to ship the dll with your script and put the directory your script is in into %PATH% before "import mpv": os.environ["PATH"] = os.path.dirname(__file__) + os.pathsep + os.environ["PATH"] If mpv-1.dll is located elsewhere, you can add that path to os.environ["PATH"].')
51+
52+
try:
53+
# flags argument: LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
54+
# cf. https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa
55+
backend = CDLL(dll, 0x00001000 | 0x00000100)
56+
except Exception as e:
57+
if not os.path.isabs(dll): # can only be find_library, not the "look next to mpv.py" thing
58+
raise OSError(f'ctypes.find_library found mpv.dll at {dll}, but ctypes.CDLL could not load it. It looks like find_library found mpv.dll under a relative path entry in %PATH%. Please make sure all paths in %PATH% are absolute. Instead of trying to load mpv.dll from the current working directory, put it somewhere next to your script and add that path to %PATH% using os.environ["PATH"] = os.path.dirname(__file__) + os.pathsep + os.environ["PATH"]') from e
59+
else:
60+
raise OSError(f'ctypes.find_library found mpv.dll at {dll}, but ctypes.CDLL could not load it.') from e
4261
fs_enc = 'utf-8'
62+
4363
else:
4464
import locale
4565
lc, enc = locale.getlocale(locale.LC_NUMERIC)
@@ -1375,11 +1395,17 @@ def run(self, command, *args):
13751395

13761396
def quit(self, code=None):
13771397
"""Mapped mpv quit command, see man mpv(1)."""
1378-
self.command('quit', code)
1398+
if code is not None:
1399+
self.command('quit', code)
1400+
else:
1401+
self.command('quit')
13791402

13801403
def quit_watch_later(self, code=None):
13811404
"""Mapped mpv quit_watch_later command, see man mpv(1)."""
1382-
self.command('quit_watch_later', code)
1405+
if code is not None:
1406+
self.command('quit_watch_later', code)
1407+
else:
1408+
self.command('quit_watch_later')
13831409

13841410
def stop(self, keep_playlist=False):
13851411
"""Mapped mpv stop command, see man mpv(1)."""

0 commit comments

Comments
 (0)