0

Tried to open file with unicode name on moviepy v1.0.0 and v1.0.1. Ubuntu does not work. Mac works.

Ubuntu:

Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 13:51:32) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from moviepy.video.io.VideoFileClip import VideoFileClip
>>> videopath='PSY - GANGNAM STYLE(강남스타일) M V.mp4'
>>> clip = VideoFileClip(videopath)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../lib/python3.6/site-packages/moviepy/video/io/VideoFileClip.py", line 91, in __init__
    fps_source=fps_source)
  File ".../lib/python3.6/site-packages/moviepy/video/io/ffmpeg_reader.py", line 33, in __init__
    fps_source)
  File ".../lib/python3.6/site-packages/moviepy/video/io/ffmpeg_reader.py", line 276, in ffmpeg_parse_infos
    "path.")%filename)
OSError: MoviePy error: the file PSY - GANGNAM STYLE(강남스타일) M V.mp4 could not be found!
Please check that you entered the correct path.



ffmpeg -version
ffmpeg version 4.1.3-0york1~14.04 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)

Mac:

Python 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 14:01:38) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from moviepy.video.io.VideoFileClip import VideoFileClip
>>> videopath='PSY - GANGNAM STYLE(강남스타일) M V.mp4'
>>> clip = VideoFileClip(videopath)
>>>


ffmpeg -version
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple LLVM version 10.0.1 (clang-1001.0.46.3)

How to make moviepy to open unicode file name on Ubuntu?

Update: The issue is name. It looks the same when copy/paste, but it seems has different encoding.

>>> videopath1
'PSY - GANGNAM STYLE(강남스타일) M V.mp4'
>>> videopath
'PSY - GANGNAM STYLE(강남스타일) M V.mp4'
>>> 
>>> 
>>> clip = VideoFileClip(videopath1)
>>> clip = VideoFileClip(videopath)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "../lib/python3.6/site-packages/moviepy/video/io/VideoFileClip.py", line 91, in __init__
    fps_source=fps_source)
  File "../lib/python3.6/site-packages/moviepy/video/io/ffmpeg_reader.py", line 33, in __init__
    fps_source)
  File "../lib/python3.6/site-packages/moviepy/video/io/ffmpeg_reader.py", line 276, in ffmpeg_parse_infos
    "path.")%filename)
OSError: MoviePy error: the file PSY - GANGNAM STYLE(강남스타일) M V.mp4 could not be found!
Please check that you entered the correct path.

For above 2 names, if copying to clipboard, somehow they are different. Therefore, it has nothing to do with moviepy.

user3792705
  • 577
  • 3
  • 18

1 Answers1

0

Encoding is the same (namely UTF-8), the difference is that videopath1 is composed and videopath is decomposed.

"PSY - GANGNAM STYLE(\x{ac15}\x{b0a8}\x{c2a4}\x{d0c0}\x{c77c}) M V.mp4"
"PSY - GANGNAM STYLE(\x{1100}\x{1161}\x{11bc}\x{1102}\x{1161}\x{11b7}\x{1109}\x{1173}\x{1110}\x{1161}\x{110b}\x{1175}\x{11af}) M V.mp4"
daxim
  • 39,270
  • 4
  • 65
  • 132
  • Thank you. The reason I got 2 different decomposed paths is the file is on shared drive. I used Ubuntu and Mac to "retrieve, store it in db". This process (same code) end up with differently. Both machine installed moviepy v1.0.0 (moviepy plays no part in the file manipulation process). I still don't understand why 2 paths are decomposed differently. – user3792705 Oct 07 '19 at 17:35
  • Because Apple. Their file system decomposes. https://encrypted.google.com/search?q=hfs%2B+nfd If you read a file name for comparison purposes, you have to take care to normalise both sides to the same form. – daxim Oct 08 '19 at 07:06