Giter VIP home page Giter VIP logo

Comments (10)

KenjiTakahashi avatar KenjiTakahashi commented on August 14, 2024 1

The script itself doesn't do any pre-validation of the input. You should be able to pass anything as filepath.
I don't really know much about Windows, but I did a quick test with W10 in VM and it works as expected.
Looks like some kind of environment configuration problem. Maybe the argument is being passed to the Python interpreter, instead of to the script, for some reason?

from mpdecimate_trim.

KenjiTakahashi avatar KenjiTakahashi commented on August 14, 2024 1

Yes, the message comes from Python, but from inside the stdlib.
Generally, just issuing mpdecimate_trim.py some/path/with/file.mp4 or similar should work fine.
Like I mentioned, the filepath is not pre-validated, so even calling mpdecimate_trim.py whatever_value should still get you through. [It will fail later, but not with this message.]

from mpdecimate_trim.

KenjiTakahashi avatar KenjiTakahashi commented on August 14, 2024 1

Well, I don't really know what people are using for Python on Windows.
What I did:

  1. Boot W10 in VM.
  2. Install Python using the latest installer from https://python.org (make sure python executables are added to PATH, the installer can do it but don't recall if it's by default).
  3. Download the script.
  4. Open terminal and run the script like usual: mpdecimate_trim.py some_file_or_we.

What you can also try is explicitly running it through the interpreter: python mpdecimate_trim.py <filepath>. It shouldn't be necessary, but who knows.

from mpdecimate_trim.

KenjiTakahashi avatar KenjiTakahashi commented on August 14, 2024 1

At least it runs now :-).
Looks like the decimate phase goes through, but it fails when trying to start the encoding.
There is some discussion about similar error in #1, you can try to apply the change mentioned there and see if the temp file actually gets created, what are the contents, permissions, etc.

I am currently away from my main workstation, won't be able to check more until sometime new week.

from mpdecimate_trim.

KenjiTakahashi avatar KenjiTakahashi commented on August 14, 2024 1

I know it has taken forever, but I have just pushed a new version with completely new algorithm for detecting the duplicates. In my tests, it works much better than the previous one.
I've also tweaked the "UI" parts, so it is easier to tell what's happening in case of failures.
Hopefully this effectively resolves the existing issues.
Feel free to check it out and let me know of any problems, if you're still around ;-).

from mpdecimate_trim.

mart-hill avatar mart-hill commented on August 14, 2024

Thank you for response! I just put the script near the python.exe/pythonw.exe (it's portable AI Dungeon package), so I hope it should work - I wonder, what syntax is needed for the script to actually accept a file name? Is that error message actually from Python (indeed, I didn't see this message in the script)?

from mpdecimate_trim.

mart-hill avatar mart-hill commented on August 14, 2024

Thanks for the answers, I really appreciate them, cause while being a bit accustomed to programming in Delphi, VBS and Pascal, I'm a total clean slate with Python. So forgive me my next question - what type of Python installation should I do, to be able to use this script? :)
And I have to admit - I didn't see this solution to frozen-frames-with-sound-trim in any video editing suite, so it would be extremely helpful! Though, I don't understand, why this script fails with this particular Python... :)

from mpdecimate_trim.

mart-hill avatar mart-hill commented on August 14, 2024

Thank you, I set VM up, installed Python 3.10 with PATH, and FFMPEG (also with PATH). And, after a while (I think first part of the video is being encoded), I've got such message:

Error opening file C:\Users\Moo\AppData\Local\Temp\mpdecimate_trim.lbpbhtdy.
Failed to set value 'C:\Users\Moo\AppData\Local\Temp\mpdecimate_trim.lbpbhtdy' for option 'filter_complex_script': Invalid argument
Error parsing global options: Invalid argument
Traceback (most recent call last):
File "C:\test\mpdecimate_trim.py", line 148, in
ffmpeg(
File "C:\test\mpdecimate_trim.py", line 34, in a
r = f(*args, **kwargs)
File "C:\test\mpdecimate_trim.py", line 62, in _ffmpeg
result = run(args, check=not co, capture_output=co)
File "C:\Users\Moo\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ffmpeg', '-i', '2022-04-0219-58-35.mp4', '-filter_complex_script', 'C:\Users\Moo\AppData\Local\Temp\mpdecimate_trim.lbpbhtdy', '-map', '[vout]', '-map', '[aout]', '-c:v', 'libx265', '-preset', 'fast', '-crf', '30', '2022-04-0219-58-35.trimmed.mp4']' returned non-zero exit status 1.

Drat. :)

from mpdecimate_trim.

mart-hill avatar mart-hill commented on August 14, 2024

Yup, that seems to be working! I'll test this script in more detailed way now. :)
Do you know, if ANY video software does this kind of processing as well?

Hmm, no matter the video, the script always creates just this for ffmpeg in this temp file:
[0:v]trim=0.000000,setpts=PTS-STARTPTS[v0];
[0:a]atrim=0.000000,asetpts=PTS-STARTPTS[a0];
[v0][a0]concat=n=1:a=1[vout][aout]

Does that mean, that mpdecimate simply doesn't do anything? Videos I tested DO have repeated frames. I add per-pixel motion blur to them later, in video editor, that's why I need to remove duplicate frames (and corresponding audio to avoid discrepancy) :)
During encoding ffmpeg seems to detect dups, but doesn't drop them, which means, probably, that the script didn't do anything, right?
obraz

from mpdecimate_trim.

mart-hill avatar mart-hill commented on August 14, 2024

Thank you for your efforts! Gotta try it, since even Topaz Video AI software doesn't have this nice feature, yet. 🙂

from mpdecimate_trim.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.