alucryd / pyhenkan

Transcoding suite built around VapourSynth and FFmpeg
http://alucryd.github.io/pyhenkan/
GNU General Public License v3.0
8 stars 0 forks source link

Cannot load file, dialog does not close when selecting a video and clicking open #2

Open lwbt opened 8 years ago

lwbt commented 8 years ago

I just found your project and wanted to test it. Once I have everything setup and click the open button to load a video file through the file chooser to dialog does not close. This is the terminal output I get:

lwbt@vwily:~/pyhenkan$ pyhenkan
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/__init__.py", line 254, in on_open_clicked
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/__init__.py", line 342, in _populate_tracklist
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/__init__.py", line 392, in _populate_vcodecs
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/codec.py", line 19, in is_avail
AttributeError: 'module' object has no attribute 'run'

OS is a Ubuntu 15.10 VM, I did install pyhenkan with the following commands:

sudo add-apt-repository ppa:djcj/vapoursynth
sudo apt-get update
sudo apt-get install git python3 vapoursynth-python3 vapoursynth-extra-plugins python3-setuptools mediainfo ffmpeg
git clone https://github.com/alucryd/pyhenkan.git
cd pyhenkan
sudo python3 ./setup.py install

I looked a bit at the code and tried to figure most of the things out myself, did I miss something or did I hit a bug? Let me know how I can help out.

Edit: added vapoursynth-extra-plugins to install command

alucryd commented 8 years ago

Sounds like python 3 on ubuntu is too old, the run method was added to subprocess in python 3.5. I believe there's a PPA lying around with more recent python versions.

BTW, please be careful with vapoursynth R30, I haven't tried it yet and it's not clear whether the source filters are compatible or they just need to be rebuilt. Also, I don't think there are any PPAs for them, you'll probably have to build them yourself, same with all other vapoursynth plugins that are not native (like f3kdb, fluxsmooth, temporalsoften...).

I plan to write something to check codecs and plugins availability, right now codecs appear when they are found (you probably won't have fdkaac or faac in your distro's ffmpeg), vapoursynth plugins are harder to check, they're present even if you don't have them installed.

alucryd commented 8 years ago

I just added a compat workaround for Python versions before 3.5, would you mind trying again? I tried VapourSynth R31, source filters work fine with it. Also I wrote a new page in the tools menu button that will tell you which codec and plug-ins you have installed and which you don't. I still need to enforce having at least one source plugin for VapourSynth, right now it will happily launch regardless.

lwbt commented 8 years ago

Thank you for your feedback, I'm sorry that I did not reply earlier. I primarily use Ubuntu, but most of the of the encoding work I do is currently done on Arch. :)

I checked and Python 3.5 is actually in the repositories for Ubuntu 15.10 and 16.04 (I couldn't clone and upgrade a machine to this version at the time), but 3.4 is set as the default in 15.10, at least here for me.

Okay, first I think there is a regression. When selecting a file (mp4), the window does not close, this time with the following message:

lwbt@vwily:~/pyhenkan$ vspipe -v
VapourSynth Video Processing Library
Copyright (c) 2012-2016 Fredrik Mellbin
Core R31
API R3.4
Options: -

lwbt@vwily:~/pyhenkan$ python3.5 /usr/local/bin/pyhenkan
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.4 of module 'vapoursynth' does not match runtime version 3.5
  return f(*args, **kwds)
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: builtins.type size changed, may indicate binary incompatibility
  return f(*args, **kwds)
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pyhenkan-0.1.0-py3.5.egg/pyhenkan/__init__.py", line 248, in on_open_clicked
AttributeError: 'MediaFile' object has no attribute 'filters'

I remember that it was working after your first comment, so I went back with git checkout --detach 0bdaa36 and can confirm that it is still working from the older commit.

Checking with Python 3.4, the GUI doesn't come up at all:

lwbt@vwily:~/pyhenkan$ python3.4 /usr/local/bin/pyhenkan
Traceback (most recent call last):
  File "/usr/local/bin/pyhenkan", line 9, in <module>
    load_entry_point('pyhenkan==0.1.0', 'gui_scripts', 'pyhenkan')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2355, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2361, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/__init__.py", line 518, in <module>
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/__init__.py", line 35, in __init__
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/environment.py", line 67, in __init__
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/environment.py", line 74, in check_codecs
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/codec.py", line 30, in is_avail
AttributeError: 'int' object has no attribute 'stdout'

The issue is the same for Ubuntu 16.04 (xenial, development) which has 3.5 set as default. There is no vapoursynth PPA for this version yet, I just modified the apt source line to point to wily, resulting in the same compiletime warning shown above and that you already mentioned, I guess.

lwbt@vxenial:~/pyhenkan$ python3.5 /usr/local/bin/pyhenkan
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.4 of module 'vapoursynth' does not match runtime version 3.5
  return f(*args, **kwds)
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: builtins.type size changed, may indicate binary incompatibility
  return f(*args, **kwds)
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pyhenkan-0.1.0-py3.5.egg/pyhenkan/__init__.py", line 248, in on_open_clicked
AttributeError: 'MediaFile' object has no attribute 'filters'

With 3.4 in 16.04 I get the following where the GUI doesn't come up:

lwbt@vxenial:~/pyhenkan$ python3.4 /usr/local/bin/pyhenkan
Traceback (most recent call last):
  File "/usr/local/bin/pyhenkan", line 9, in <module>
    load_entry_point('pyhenkan==0.1.0', 'gui_scripts', 'pyhenkan')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 568, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2720, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2380, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2386, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/__init__.py", line 7, in <module>
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/codec.py", line 8, in <module>
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
    from . import _gi
ImportError: cannot import name '_gi'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ImportError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/local/bin/pyhenkan", line 9, in <module>
    load_entry_point('pyhenkan==0.1.0', 'gui_scripts', 'pyhenkan')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 568, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2720, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2380, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2386, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/__init__.py", line 7, in <module>
  File "/usr/local/lib/python3.4/dist-packages/pyhenkan-0.1.0-py3.4.egg/pyhenkan/codec.py", line 8, in <module>
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
    from . import _gi
ImportError: cannot import name '_gi'
lwbt@vxenial:~/pyhenkan$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
alucryd commented 8 years ago

I set up an Ubuntu 15.10 VM to test python 3.4. Looks like the call method only returns the exit code which is why it didn't work. I used Popen instead and another workaround (which won't detect the soxr resampler, I'll write sth more complex if needed) and it now works fine. Please let me know if it works okay (also make sure to install mkvtoolnix, I noticed it was missing from your installation steps).

I usually encode MKVs only, but MP4 files should work as well, I loaded one on that VM without issue. Can you share that MP4 somewhere, or post the full text report from mediainfo so that I can investigate?

BTW, I'm using Arch exclusively, this is written and tested on Arch so you'll generally have better luck there. I've got an AUR package and one on my unofficial repo (rebuilt every night when there's a new commit), you'll find links on the project page: http://alucryd.github.io/pyhenkan/

alucryd commented 8 years ago

FYI, the AttributeError: 'MediaFile' object has no attribute 'filters' is triggered when you don't have any source plugin installed for vapoursynth. The extra plugin package from that PPA should contain the ffmpegsource plugin so you should be fine wiith it. I'll catch the error and prevent any file opening in that case when I find the time.

rcrath commented 8 years ago

tried installing on arch, installs without error, but I get the same problem with the open file dialog not closing but a different error message if that helps. vapoursynth R31

[~]$pyhenkan 
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/pyhenkan/__init__.py", line 245, in on_open_clicked
    f.filters = self.workfile.filters
AttributeError: 'MediaFile' object has no attribute 'filters'
Terminated
alucryd commented 8 years ago

You need at least one vapoursynth source filter, either ffms2 or lsmashsource, both are in [community].

rcrath commented 8 years ago

That did it.