MediaArea / MediaConch

MediaConch (funded by PREFORMA)
31 stars 11 forks source link

MediaConch CLI 16.06 crashes on Windows 7 #147

Closed t-rapp closed 8 years ago

t-rapp commented 8 years ago

When I run MediaConch CLI 16.06 32/64-bit on Windows 7 64-bit with a filename as the only argument it crashes after some small delay: MediaConch.exe ffmpeg-ffv1-noise01.avi

The following statements seem to work: MediaConch.exe --mediainfo ffmpeg-ffv1-noise01.avi MediaConch.exe --mediatrace ffmpeg-ffv1-noise01.avi MediaConch.exe --mediaconch --policy=Test-AVI_FFV1.xsl ffmpeg-ffv1-noise01.avi

tribouille commented 8 years ago

Hi,

MediaConch.exe ffmpeg-ffv1-noise01.avi equivalent is MediaConch.exe --mediaconch --Format=text ffmpeg-ffv1-noise01.avi Does this one is also crashing?

Can you provide the video file?

t-rapp commented 8 years ago

Yes, MediaConch.exe --mediaconch --Format=text ffmpeg-ffv1-noise01.avi also crashes.

I can provide the video file if necessary but honestly I tried ~5 different files (.avi, .mkv, *.wav) and it always crashes. It doesn't crash when I add --policy=Test-AVI_FFV1.xsl and it doesn't crash when I use the MediaConch GUI version. My guess would be that the issue is caused by some missing check for a valid policy file argument.

tribouille commented 8 years ago

My guess would be that the issue is caused by some missing check for a valid policy file argument.

No, same code for Linux/Mac/Windows, and it is working for them. (The Implementation/MediaInfo/MediaTrace report call are not related to policy)

I tried on a Windows machine, cannot reproduce. (with file: https://github.com/MediaArea/MediaConch_SampleFiles/raw/master/PolicyTestFiles/FFV1/ffv1_test_pixfmt-bgr0_coder-0_level-1.mkv)

In order of checks:

  1. Do MediaConch is creating the MediaConch.db and MatroskaSchema.xml in your C:\Users\$USER\AppData\Roaming\MediaConch directory? (if yes, try to remove it and launch it again to see if it is created)
  2. Do you have any information in your shell about an error? Or in Windows pop-up crash?
  3. Do MediaConch.exe -mc -fx ffmpeg-ffv1-noise01.avi crashing? (generate only the XML report without applying display to it)
  4. Do the reports generated with --mediatrace and --mediainfo look ok?
  5. If yes for the 4. , do MediaConch.exe -mt -mc -mi ffmpeg-ffv1-noise01.avi crashing? (generate a report with MediaInfo, MediaTrace and MediaConch reports in it)
t-rapp commented 8 years ago

My following tests have been done using the Matroska/FFV1 file from the link you provided.

Do MediaConch is creating the MediaConch.db and MatroskaSchema.xml in your C:\Users\$USER\AppData\Roaming\MediaConch directory?

No, MediaConch.db is created in the same directory as MediaConch.exe and I couldn't find any occurence of MatroskaSchema.xml.

Do you have any information in your shell about an error? Or in Windows pop-up crash?

There is some Windows pop-up dialog with the following information (German OS l10n):

Problemsignatur:
  Problemereignisname:  BEX64
  Anwendungsname:   MediaConch.exe
  Anwendungsversion:    16.6.0.0
  Anwendungszeitstempel:    5774f63c
  Fehlermodulname:  MediaConch.exe
  Fehlermodulversion:   16.6.0.0
  Fehlermodulzeitstempel:   5774f63c
  Ausnahmeoffset:   00000000005c260d
  Ausnahmecode: c0000417
  Ausnahmedaten:    0000000000000000
  Betriebsystemversion: 6.1.7601.2.1.0.256.48
  Gebietsschema-ID: 1031
  Zusatzinformation 1:  7fc7
  Zusatzinformation 2:  7fc77b4f7b895b3c6d37c06765769c44
  Zusatzinformation 3:  5687
  Zusatzinformation 4:  5687371ee69037d7808d557bc1278dcb

Do MediaConch.exe -mc -fx ffmpeg-ffv1-noise01.avi crashing?

Yes (also when using the linked Matroska/FFV1 file).

Do the reports generated with --mediatrace and --mediainfo look ok?

Yes, see attached files: ffv1_test_pixfmt-bgr0_coder-0_level-1_mediainfo.txt ffv1_test_pixfmt-bgr0_coder-0_level-1_mediatrace.txt

If yes for the 4. , do MediaConch.exe -mt -mc -mi ffmpeg-ffv1-noise01.avi crashing?

No, it prints a line to the console: Combination of MediaConch and MediaTrace is currently not possible with Text output. When I use MediaConch.exe -mt -mc -mi -fx ffv1_test_pixfmt-bgr0_coder-0_level-1.mkv it crashes.

tribouille commented 8 years ago

If I remove the credentials to the C:\Users\$USER\AppData\Roaming\MediaConch, I can reproduce it. It's due to the error generated by the implementation XSL du to the MatroskaSchema.xml missing.

To make it works with the 16.06 release, you will have to give the credentials.

I will correct the crash and make a fallback directory to current (same as MediaConch.db) when credentials are not given.

t-rapp commented 8 years ago

I don't know why MediaConch.exe assumes it doesn't have the credentials. In the same CMD dialog where I run MediaConch I can do

cd %APPDATA%
md MediaConch
cd MediaConch
echo "Hello world!" > hello.txt

without problems. I also removed the "downloaded-from-internet" flag (Zone.Identifier ADS entry) which was set after unzipping the files downloaded from the MediaArea site but it didn't make a difference.

tribouille commented 8 years ago

Hmmm, my first guesses will be...

  1. Directory Roaming in %APPDATA% does not have the credentials
  2. your %APPDATA% is not in C:\Users\$USER\AppData
  3. your $USER contains non-ASCII characters and MC does not understand it.

NB: I'm not a Windows user neither I tried so, my guesses can be wrong.

I remember now that we added an option to indicates the MatroskaSchema.xml, you can by-pass, for the moment, this problem using --ImplementationSchema=$PATH_TO_MATROSKA_SCHEMA_XML MatroskaSchema.xml can be found here: https://github.com/MediaArea/MediaConch/blob/master/MetadataDevelopment/ImplementationChecks/MatroskaSchema.xml

t-rapp commented 8 years ago

Directory Roaming in %APPDATA% does not have the credentials

Permissions are OK based on the tests in my previous reply.

your %APPDATA% is not in C:\Users\$USER\AppData

your $USER contains non-ASCII characters and MC does not understand it.

echo %APPDATA% returns C:\Users\Tobias.KUHNLE\AppData\Roaming.

I grepped for "AppData" in the MediaConch sources and stumbled over the following lines in Source/Common/Core.cpp:

std::string Core::get_local_config_path()
{
    std::string local_path(".");
#if defined(WINDOWS)
    char username[UNLEN+1];
    DWORD username_len = UNLEN+1;
    GetUserNameA(username, &username_len);

    std::string wuser(username, username_len-1);
    std::string user_name(wuser.begin(), wuser.end());
    std::stringstream path;

    path << "C:/Users/" << user_name << "/AppData/Roaming/MediaConch/";
    local_path = path.str();
#elif defined(UNIX) 

Building the AppData-path like this won't work reliably. For example I have an account "Tobias" on my local machine plus a domain account "KUHNLE\Tobias". In both cases GetUserName() will return only "Tobias" but for the domain account the user folder is "C:\Users\Tobias.KUHNLE" (see above).

You should use SHGetFolderPath with CSIDL_APPDATA instead or the newer SHGetKnownFolderPath. BTW: Using the Unicode-capable Windows API function variants is highly recommended :-)

tribouille commented 8 years ago

echo %APPDATA% returns C:\Users\Tobias.KUHNLE\AppData\Roaming.

Ah ok. I thought it gave the path without the Roaming folder.

You should use SHGetFolderPath with CSIDL_APPDATA instead or the newer SHGetKnownFolderPath.

SHGetFolderPath is deprecated, I'll use SHGetKnownFolderPath.

t-rapp commented 8 years ago

I can confirm that the issue is solved in MediaConch 16.08. Thanks!

tribouille commented 8 years ago

Thank you for the tips (SHGetKnownFolderPath).

I kept the issue opened because the crash on Windows itself is not resolved. When the application cannot create the schema or the schema is not available, the XSLT library has a wrong behavior (writting to stderr which makes it crashes).

Anyway, I will open a new ticket about it soon with all information as your problem is solved and makes the issue clearer.