4

I use avisynth to demux video from audio. When I use

 x = "m.mkv"
 ffvideosource(x)

It work correctly but when I change my video filename to a UTF-8 one and my script as:

 x = "م.mkv"
 ffvideosource(x)

I Got the following error: failed to open for hashing avisynth

I found a link (UTF-8 source files are not supported) who tell UTF-8 file name not work in avisynth, and to correct the problem, it said:

specify the parameter utf8=true when calling ffvideosource, save the script as UTF-8 without BOM and then see if that works.

But, I couldn't solve the problem. As I Open the script in the notepad and save it in utf-8 format, I got the following error:

UTF-8 Source files are not supported, re-save script with ANSI encoding

How can I solve the problem, How can I run my script with a UTF-8 filename?

Hadi Rasekh
  • 2,622
  • 2
  • 20
  • 28

2 Answers2

3

“Withoutt BOM” is important. You need to save the file as raw UTF-8 without the Microsoft-style faux-BOM. Notepad can't do this, it always saves UTF-8 files with that generally-undesirable 0xEF 0xBB 0xBF header. Most other text editors (e.g. Notepad++) can do it properly.

AviSynth isn't really Unicode-aware so it doesn't want you using UTF-8 and will give that error message to try to stop you making mistakes. ffvideosource's workaround of hiding UTF-8 bytes in what AviSynth sees as ‘ANSI’ characters only works as long as AviSynth sees the file as ANSI. AviSynth doesn't have very sophisticated encoding-guessing, so removing the faux-BOM is enough to convince it is dealing with ANSI.

MarianD
  • 13,096
  • 12
  • 42
  • 54
bobince
  • 528,062
  • 107
  • 651
  • 834
2

Very common problem when using UTF-8 in AviSynth.

Follow these steps:

  1. Check the plugins folder. There should exist these three files: ffms2.dll, ffmsindex.exe, and FFMS2.avsi. If you did not have problem with ANSI, I guess that you don't have FFMS2.avsi in your plugins folder; In this situation download the latest version form here.

  2. After that make an AVS file with Notepad++. For example I do this:

    x = "C:/Users/Nemat/Desktop/StackOverFlow/نعمت.mkv"
    ffmpegsource2(x,utf8=true)
    

    Please note that here I used ffmpegsource2().

  3. In the Encoding menu from Notepadd++ select Encode in UTF-8 without BOM.

  4. Save your file.

  5. Check the video file exists in the addressed directory.

  6. Double click on your AVS file.

  7. Enjoy it!

MarianD
  • 13,096
  • 12
  • 42
  • 54