Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem reading metadata in Windows #9

Open
azcn2503 opened this issue Dec 4, 2014 · 12 comments
Open

Problem reading metadata in Windows #9

azcn2503 opened this issue Dec 4, 2014 · 12 comments

Comments

@azcn2503
Copy link

azcn2503 commented Dec 4, 2014

read is returning an empty object when used on Windows. ffmpeg was installed using chocolatey, so this should have taken care of dependencies. I am able to use read on the same file successfully on the Mac, with ffmpeg installed via homebrew. Is there some additional configuration required on Windows for it to work?

@parshap
Copy link
Owner

parshap commented Dec 4, 2014

I think there are two scenarios where this is possible:

  1. The input file actually does not have any metadata.
  2. ffmpeg fails but still returns with an success exit code of 0. I think there are a some bugs in ffmpeg that can cause this to happen.

I suggest debugging this and seeing what ffmpeg’s stderr output is. Right now if the exit code is 0, we assume success ignore stderr. You can use a debugger or edit the source to see the stderr output (see here, or you can use the dryRun option to see the arguments being used to run ffmpeg are and run ffmpeg manually yourself with the same arguments to see what happens. (I just added the dryRun option and released in v1.3.0.)

/cc @egoroof: I think you are using ffmetadata under windows - have you seen this issue?

@egoroof
Copy link

egoroof commented Dec 5, 2014

No, I have no problems. Also even when I use ffmetadata with an input file which does not have any ID3 tags I get an object with "encoder" property. It works great with russian language)
@azcn2503 I think the problem may be in PATH property in system variable. Can you run ffmpeg using command line just typing "ffmpeg"?

@azcn2503
Copy link
Author

azcn2503 commented Dec 5, 2014

Ok, if I run ffmpeg directly from the console with the command: ffmpeg -i "D:/Music/Altitude - Homecoming.mp3" -f ffmetadata pipe:1 I can see the metadata without any problems. ffmpeg is added to the PATH, so I am able to run it without using the absolute path. I'll continue to investigate.

@egoroof
Copy link

egoroof commented Dec 5, 2014

What about js? What code do you use?
What version of nodejs do you use?
Try to run included tests.

@azcn2503
Copy link
Author

azcn2503 commented Dec 5, 2014

Here is a sample of code I am using:

var dir = require('node-dir');
var ffmetadata = require('ffmetadata');

dir.files('D:/Music/Anjunabeats Vol. 11/Split/CD 1', function(err, files) {
    if(err) { throw err; }
    (function iterateFiles(n) {
        n = n || 0;
        if(n == files.length - 1) { return; }
        console.log(files[n]);
        if(!/.(mp3|wav|aac)$/.test(files[n])) { iterateFiles(n + 1); return; }
        ffmetadata.read(files[n], function(err, metadata) {
            if(err) { console.error('Could not read file'); }
            else { console.log(metadata); }
            setTimeout(function() {
                iterateFiles(n + 1);
            }, 1000);
        });
    })();
});

I managed to get a screenshot as the ffmpeg process was closing. In the screenshot you can see that ffmpeg is grabbing the metadata correctly but it is not brought back to ffmetadata for whatever reason.

I tried to run the test by browsing to the node_modules/ffmetadata/test directory and running node test.js but it failed with the error:

module.js:340
    throw err;
          ^
Error: Cannot find module 'tape'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (D:\Git\id3\node_modules\ffmetadata\test\test.js:7:9)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

Update: I was using node v0.10.22. I since upgraded to v0.10.33, but the error persists.

screenshot - 05_12_2014 12_50_04

@egoroof
Copy link

egoroof commented Dec 5, 2014

Before running tests install tape module to D:\Git\id3\node_modules\ffmetadata via npm.

@parshap
Copy link
Owner

parshap commented Dec 5, 2014

@azcn2503 to run tests, run npm install then npm test from the root directory of the ffmetadata project.

The output form ffmpeg looks alright at first glance. There could be a problem with the parsing of the output. Maybe try to see what's going on around here.

Have you tried the same exact mp3 file on osx and it works?

@parshap
Copy link
Owner

parshap commented Dec 19, 2014

@azcn2503: Did you ever get this working? If you can share the mp3 file with me I can try to debug it locally.

@azcn2503
Copy link
Author

Apologies for the delay, I'm traveling for the next few weeks and will try
to continue working on this project in early January.
On 20 Dec 2014 00:33, "Parsha Pourkhomami" notifications@github.com wrote:

@azcn2503 https://github.com/azcn2503: Did you ever get this working?
If you can share the mp3 file with me I can try to debug it locally.


Reply to this email directly or view it on GitHub
#9 (comment)
.

@jcorbett
Copy link

I had the same issue on windows 10. A quick change on line 118 to change the detached value from true, to false fixed it for me:

return ffmpeg(args, { detached: false, encoding: "binary" });

@parshap
Copy link
Owner

parshap commented Jan 24, 2017

I'm not sure why detached was true in the first place. Interested in sending a PR to change that?

alirezamirian added a commit to alirezamirian/node-ffmetadata that referenced this issue Apr 9, 2018
@gritex
Copy link

gritex commented Jan 12, 2019

@parshap Please merge the pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants