lordmulder / LameXP

Audio Encoder Front-End
http://lordmulder.github.io/LameXP
Other
183 stars 18 forks source link

Encoding FLACs to OPUS files into a different directory can cause the encoder to hang #110

Closed GammaBoost closed 1 year ago

GammaBoost commented 1 year ago

If you try to encode a FLAC file to OPUS from one directory into a different directory, the OPUS encoder can freeze. This can happen to individual files in a batch encode, or even in single encodes. The job will be stuck with the status of "Encoding (0%)" and pressing abort is unable to close it. The encoder will not use any CPU. Closing the program requires ending the task in task manager. image

The resulting file will appear to be 0 bytes, and cannot be deleted. Screenshot (443)

Depending on the situation, you may have to use a program like Powertoys' File Locksmith to end both explorer.exe and dllhost.exe. Once you have done this, you can then open command prompt to use "del /F {filename}" to delete the file. In other cases it can sometimes be deleted normally after ending the tasks.

Enabling the option "Save output files to the same location where the input file is located" in the Output Directory tab should prevent this issue from happening.

Operating System: Windows 10 64-bit 22H2 LameXP version: 4.19 Final-1, Build 2320

lordmulder commented 1 year ago

Hello.

I have never seen this problem, and I convert a lot of files, including FLAC to Opus. You also are the first one to report this.

Don't see how the output directory can make a difference here.

Anyway, encoding "into a different directory" is my standard use-case that I do all the time 😏

So, first things first; Do you have any "anti-virus" software, other than Microsoft Security Essential (Windows Defender), installed ???

If so, please uninstall the thing and try again on a "clean" system!

Otherwise, please start LameXP with command-line option --console and see if there is anything "suspicious" in the log.

Furthermore, if the problems should happen again: Look at Process Explorer and check if there are any "hanging" opusenc.exe or flac.exe processes started by LameXP.

Last but not least, you can try the latest test build, though I doubt it makes a difference, but you never know: https://sourceforge.net/projects/lamexp/files/Snapshots%20%28BETA%29/

Regards.

BTW: LameXP has absolutely nothing to do with either explorer.exe or dllhost.exe 😕

GammaBoost commented 1 year ago

Hello.

I have tried everything. More things than you've suggested, just in the hopes that it could work. I can't figure it out. However, I can give you a number of pieces of info:

  1. I have managed to create a file that consistently fails to get past the encoder. 66.8MB, 8:32 long. Does not work ever when converted directly from FLAC to OPUS.
  2. The output directory does not, in fact, affect whether it is able to successfully convert.
  3. Neither the console or Process Explorer appear to show any errors or issues, other than the encoder using 0% CPU.
  4. Closing any programs do not appear to do anything. The only Antivirus I have is Windows Defender.
  5. The test build does not change anything.
  6. You can actually normally delete the output file if you continually end the processes with File locksmith, and then eventually you can just delete it normally. However it seems to struggle with being deleted from the recycle bin afterwards, but continually trying will eventually allow you to. I think this isn't really related to the main issue though, but I'm pretty sure the file is corrupted in a way that prevents the OS from properly understanding the file.
  7. The file only fails on some FLACs. It passed on a 38MB FLAC, failed on a 39MB FLAC, passed on a 48MB FLAC again.
  8. The computer this is occurring on is an ASUS FX505DT gaming laptop running Windows 10 purchased at the end of 2020, and I've installed a lot of things in the past. It is definitely not a very clean installation.
  9. THE ISSUE DOESN'T OCCUR ON MY WINDOWS 11 LAPTOP!! I transferred the FLAC I was testing with to my Surface Laptop 4 running Windows 11, which I bought late last year, using the same stable build of LameXP as my other laptop, and there was no issue whatsoever. It just encoded it in no time. I don't know what exactly the difference is, but that installation of Windows is definitely a lot cleaner than the one on my ASUS laptop, so that could make a difference. Perhaps I can try to upgrade this laptop to Windows 11 too and see if it works? Probably not likely though.

So yeah. I'm struggling to figure out what the issue is, I don't know what could be affecting it. I should perhaps attempted to clean up this computer but that is a fairly painstaking process which I wouldn't want to waste a day doing. I think for now if I ever want to convert a FLAC to OPUS, I can temporarily convert it to WAV first which shouldn't be an issue.

Hope my info helps, probably not. Perhaps you can install a bunch of viruses on a computer and test it then, haha.

PS; VLC media player sometimes stuggles to play these FLACs as it occasionally stutters at consistent points of a song. I don't think this is related, however.

lordmulder commented 1 year ago

As long as the problem cannot reliably be reproduced on another machine, there is hardly anything we can do 😥

If a problem appears on just one machine for no obvious reason, it is more likely that there's something "odd" with that machine.

More often than not, "unexplainable" hangs and things like that are caused by, e.g., anti-virus software going berserk.

Keep in mind that LameXP is just a GUI front-end. It invokes encoder/decoder programs like opusenc.exe or flac.exe and then lets them do their job. If the encoder/decoder process "hangs" for whatever reason, LameXP can not do anything about it. Have you tried running opusenc.exe or flac.exe manually from the terminal, with the same parameters that LameXP is passing?

I see no reason why you shouldn't be able to delete the output file, once the encoder process has been terminated. Yes, a running process can "lock" its open files. But, once the process is terminated, there should be nothing "blocking" these files. Files being "inaccessible" for no apparent reason is yet another thing you often see with anti-virus software etc. going berserk...

VLC player "struggling" to play some FLAC files (I supposed those files play fine on anther machine) even more indicates that there is a more "fundamental" problem with the machine. Possibly some kind of hardware issues. Have you checked your HDD/SSD?

Geilor commented 1 year ago

Hello there, I am new to the board.

I have the same issue with the opus codec. For example, if I want to extract a mp3-file from my mp4-video, it works just fine. If I try to convert ANY file to opus the program freezes. If you click on "Abort" it takes a veeeery long time to actually abort, or you can just end the prog with the task manager. This leads to 0 byte Opus Files, which you can only delete in Windows Safety Mode. 🗡️ 😃

In Windows safe mode however the program works just fine.

What could be the origin of this problem?

UPDATE:

I just installed the K-Lite Codec Pack and now it works. Maybe try this @GammaBoost

GammaBoost commented 1 year ago

Well, I'm glad that someone else has a similar issue! Unfortunately I won't be able to test as I am currently overseas away from my primary laptop, but I'll test once I get back.

lordmulder commented 1 year ago

What could be the origin of this problem?

Still now idea 😕

(except for the usual candidates, such as buggy "anti-virus" software and the like)

I just installed the K-Lite Codec Pack and now it works

But what I do know for sure is that "K-Lite Codec Pack" (or any other dubious "Codec Pack") has nothing to do with this 😏

Geilor commented 1 year ago

I don't know. It might be that the other opus codec is seen as a problematic codec? I don't know. Since I installed the codec pack it's working perfectly though.

lordmulder commented 1 year ago

LameXP uses the opus-tools command-line encoder, which is fully self-contained.

LameXP does not require or use any "Codecs" (DirectShow Filters, ACM Codecs, whatever) that you install separately.

GammaBoost commented 1 year ago

Kind of a wild shot in the dark, but are there any libraries or dependencies that are required by the encoder or LameXP itself? Perhaps something here might be the culprit.

lordmulder commented 1 year ago

Kind of a wild shot in the dark, but are there any libraries or dependencies that are required by the encoder or LameXP itself?

Nope.

People tend to believe that the last thing they installed caused (or fixed) their problem. But, quite often, the actual cause is something entirely different. If you want to be certain, you can do some A/B testing, but I doubt that installing (or removing) any "Codec Packs" will make a difference here. In fact, better stay away from that kind of stuff 😏

Geilor commented 1 year ago

Kind of a wild shot in the dark, but are there any libraries or dependencies that are required by the encoder or LameXP itself?

Nope.

People tend to believe that the last thing they installed caused (or fixed) their problem. But, quite often, the actual cause is something entirely different. If you want to be certain, you can do some A/B testing, but I doubt that installing (or removing) any "Codec Packs" will make a difference here. In fact, better stay away from that kind of stuff 😏

Look, I am no programmer. I can tell you what exactly happened. LameXP was blocked by Windows Defender. I installed it anyways. Mp3 encoding worked fine, Opus was the exact same problem as described on top.

I disabled my antivirus etc. And no I didn't deinstall it, still had the same problem. A buddy of mine said he got the K-Lite Codec Pack, which is actually a fine addition. I installed that and after that it worked. Might be coincidence, but I didn't do anything else.

That's all I can say. No freezing anymore. I can try do deinstall the K-Lite and see, if the problem comes back if that helps.

lordmulder commented 1 year ago

Again, LameXP does not need or use any of those things that people like to call "Codecs". Actually, the term "Codec" is not strictly defined. It could mean anything from ACM drivers, DirectShow Filters, MediaFoundation Transforms, etc. pp.

ACM driver would only be relevant for applications that use the ACM (Audio Compression Manager) for compressing and/or decompressing audio data; LameXP does not do this! DirectShow Filters would only be relevant for applications that are based on the DirectShow Framework; LameXP is not based on DirectShow! MediaFoundation Transforms would only be relevant for applications that are based on the MediaFoundation Framework; LameXP is not based on MediaFoundation!

If you think "Codecs" secretly sneak into totally unrelated applications and change how those applications work by applying a form of dark magic, then you are very wrong. Because a lot of people don't understand what "Codecs" actually are, and that only very specific applications can use very specific types of "Codecs", for doing very specific things, they don't understand that so-called "Codec Packs" are snake oil! If you understand the details, then you install the particular "Codec" that your particular application actually needs, for doing the particular thing that you want to do. No need to install a bunch of bloatware 😏

Anyways, I can't see how installing a "Code (Pack)" would have solved your described problem in LameXP. And it probably didn't.

(possibly Windows Defender blocked the Opus encoder on your first attempt, for reasons that only god an Bill Gates know about, but didn't do so on your second attempt – maybe because, at this time, it had seen the opusenc.exe before)

Geilor commented 1 year ago

So, I de-installed the codec pack and what do you know... the compression from mp videos to mp3 works, but opus doesn't. I reinstall the codec pack and it works fine. So, there must be something within the codec pack that changes maybe the antivirus program or the opus encoder. I don't know.

Maybe you take a look into it, because I won't. I am here to help the first poster. It comes across as super condescending if you talk about "dark magic" and BS. If you really want to make the programm better, then actually help people and don't be somewhat defensive, just because you're annoyed that people point out problems with the program.

So, tl;dr: I de-install K-Lite, it's not working. I re-install it, it works. So there must be something in that prog that changes something.

GammaBoost commented 1 year ago

Just curious, what type of K-lite installation did you do? Basic, Full, etc, and did you use the recommended install options or a custom install?

Geilor commented 1 year ago

I did the basic installation and it works.

GammaBoost commented 1 year ago

I finally got around to doing it, I tried encoding a file before and it didn't work, but I installed the K-Lite Codec Pack (basic) and it it instantly worked as it's supposed to! I'm so glad! Now we know that something that the codec pack changes also affects LameXP. Not black magic.

Geilor commented 1 year ago

Great. Works fine for me since that, too. I'm using it for our podcast. So, have fun.