cbusillo/BD_to_AVP

ERROR: failed to allocate memory

Closed this issue · 20 comments

When doing a run on an ISO, using no options but the source folder being set to '.', I get the following errors at the end of the run:

ERROR: failed to allocate memory (-4),	c:\prj\frim\frim_decode\src\pipeline_decode.cpp (852)

ERROR: failed to allocate memory (-4),	c:\prj\frim\frim_decode\src\pipeline_decode.cpp (475)

ERROR: the previous asynchrous operation is in execution (1),	c:\prj\frim\frim_decode\src\main_frim_decode.cpp (135)

0024:fixme:kernelbase:AppPolicyGetProcessTerminationMethod FFFFFFFFFFFFFFFA, 000000000011FEB0

This is on a MacBook Pro 16" M3 Max with 48G of RAM.

Thats odd and very hard to troubleshoot! FRIMDecode is the step that splits the MVC into left/right streams. If the video didn't contain a MVC track you would get error -10.

I had a few quick ideas:

The default --output-root-folder is also '.' perhaps that is an issue. Try setting a different output folder or input folder.

If you haven't already, try a different ISO or disk. Maybe there is a ripping issue.

Do you have plenty of disk space free? Due to the multiple steps, you will need around 100GB free.

Either way, would you mind posting full logs including the command so I can double check everything? Hopefully we can get this fixed for you!

I do have plenty of space (800+GB). Let me try it with the different folder options as mentioned. If it fails again I will get more logs. Thanks!

You are welcome! Please report back either way. I am interested in getting all the little bugs out. If it is the same input output folder, I can do a check for that.

Oh, and while I am thinking about it, it might be nice to have a flag that allows you to specify to clean up everything except logs if it fails

Let me think about that one. Did you notice you can continue where you left off with the --start-stage flag?

No, I missed the start-stage flag. The issue is that if you specify a source folder and want it to go through a bunch of movies and some fail and some don't you end up with a mess. I see what you are trying to do, though.

Ok, so I tried it again with the extra flag and it did not work. Same errors. I shortened the output by chopping out the frame count and extra white space:

$ bd-to-avp --source-folder . --output-root-folder ./output                                                                                                                                             

Processing ALG.iso
Running Get disc and MVC video properties |

Custom MakeMKV profile created at output/ALG_2016_ASMO/custom_profile.mmcp.xml
Running Rip disc to MKV file. /

Getting subtitle tracks from output/ALG_2016_ASMO/title_t00.mkv
Running ffmpeg to extract video, audio, and subtitles from MKV
Running Extract subtitle track from MKV /

Running FRIM to split MVC to stereo. |Error running command: FRIM to split MVC to stereo.
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005

007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005

007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005

007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.

0024:fixme:thread:get_thread_times not implemented on this platform

0108:fixme:kernelbase:AppPolicyGetThreadInitializationType FFFFFFFFFFFFFFFA, 000000000166FF50

0024:fixme:heap:GetNumaHighestNodeNumber semi-stub: 000000000011DF20

FRIM Decoder version 1.31 - Win64 (build: Mar  8 2020)

 - based on Intel(R) Media SDK

Media SDK impl		SOFTWARE (Z:\Users\username\.bd_to_avp_venv\lib\python3.12\site-packages\bd_to_avp\bin\FRIM_x64_version_1.31\x64\libmfxsw64.dll)

Media SDK version	1.28

Memory type		System

Async depth		4

Decoder			AVC

Input picture:

  Resolution		1920x1088

  PAR       		1:1

  Structure		Progressive

  Crop X,Y,W,H		0,0,1920,1080

  Frame rate		23.976

Output picture:

  Resolution		1920x1088

  PAR       		1:1

  Structure		Progressive

  Crop X,Y,W,H		0,0,1920,1080

  Frame rate		23.976

Output format		I420

Processing started

Frame number: 0

Frame number: 5

Frame number: 10

Frame number: 15
...
Frame number: 9795

Frame number: 9800

Frame number: 9805

ERROR: failed to allocate memory (-4),	c:\prj\frim\frim_decode\src\pipeline_decode.cpp (852)

ERROR: failed to allocate memory (-4),	c:\prj\frim\frim_decode\src\pipeline_decode.cpp (475)

ERROR: the previous asynchrous operation is in execution (1),	c:\prj\frim\frim_decode\src\main_frim_decode.cpp (135)

0024:fixme:kernelbase:AppPolicyGetProcessTerminationMethod FFFFFFFFFFFFFFFA, 000000000011FEB0

Hi! Did you try it with a different source disc? Also since source-folder is recursive, try with an output-folder outside of the source folder.

Sorry, I misunderstood and put the output folder in the folder with the movie. I tried it again with the command:

bd-to-avp --source-folder . --output-root-folder ../output

This puts the output folder one level up. Unfortunately, the results are the same:

I remove a LOT of whitespace here and condensed the frame count.

Processing movie.iso
Running Get disc and MVC video properties -

Custom MakeMKV profile created at ../output/ALG_2016_ASMO/custom_profile.mmcp.xml
Running Rip disc to MKV file. |

Getting subtitle tracks from ../output/ALG_2016_ASMO/title_t00.mkv
Running ffmpeg to extract video, audio, and subtitles from MKV
Running Extract subtitle track from MKV /

Running FRIM to split MVC to stereo. /Error running command: FRIM to split MVC to stereo.
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:d3d:wined3d_guess_card_vendor Received unrecognized GL_VENDOR "Apple". Returning HW_VENDOR_NVIDIA.
0024:fixme:thread:get_thread_times not implemented on this platform
0108:fixme:kernelbase:AppPolicyGetThreadInitializationType FFFFFFFFFFFFFFFA, 000000000166FF50
0024:fixme:heap:GetNumaHighestNodeNumber semi-stub: 000000000011DF20

FRIM Decoder version 1.31 - Win64 (build: Mar  8 2020)
 - based on Intel(R) Media SDK

Media SDK impl		SOFTWARE (Z:\Users\username\.bd_to_avp_venv\lib\python3.12\site-packages\bd_to_avp\bin\FRIM_x64_version_1.31\x64\libmfxsw64.dll)
Media SDK version	1.28
Memory type		System
Async depth		4
Decoder			AVC

Input picture:
  Resolution		1920x1088
  PAR       		1:1
  Structure		Progressive
  Crop X,Y,W,H		0,0,1920,1080
  Frame rate		23.976

Output picture:
  Resolution		1920x1088
  PAR       		1:1
  Structure		Progressive
  Crop X,Y,W,H		0,0,1920,1080
  Frame rate		23.976
Output format		I420

Processing started

Frame number: 0
...
Frame number: 10010

ERROR: failed to allocate memory (-4),	c:\prj\frim\frim_decode\src\pipeline_decode.cpp (852)
ERROR: failed to allocate memory (-4),	c:\prj\frim\frim_decode\src\pipeline_decode.cpp (475)
ERROR: the previous asynchrous operation is in execution (1),	c:\prj\frim\frim_decode\src\main_frim_decode.cpp (135)
0024:fixme:kernelbase:AppPolicyGetProcessTerminationMethod FFFFFFFFFFFFFFFA, 000000000011FEB0

Also, some discs work, some get this same error. I have multiple cases of each.

I have also now trie with both wine-stable and wine-staging in homebrew. Same results.

Are you in the US or a different region? Have you updated the script in the last few days?

I also noticed on all of the ones that fail, they do it in the split phase and all do it at about 1G per file for left and right.

I am in the US. I have not yet updated the script. The 1G per file thing got me wondering. I looked at filesystem stats and noticed that the drive I was writing to, which was exFAT, was reading 100% %iused in df. I have no idea what was causing it to show that, but I suspect a strange implementation of the driver plus wine using it was causing issues. In Finder and the CLI I could easily add files so the %iused had to be a false reading but I wondered if it was still causing an issue with wine for some reason. I formatted the drive APFS and tried again. I am already significantly further along in the conversion process. I will let you know if it finishes.

The conversion of the ISO that previous failed repeatably has completed successfully when done on an APFS filesystem. I can only assume that wine is not handling something correctly on exFAT partitions that causes it to fail.

That is strange! I may need to format a drive exFAT and duplicate your issue to see if it's a problem with Wine/FRIM or if it was just a problem with your drive. Was it a HDD or SSD? Had you tried reformatting it with exFAT at all to rule out file system corruption? It's really odd that some did work. If you are using a relatively updated version, I filtered out all the bad chars since we had some issues with things like periods.

Thank you for the update!

It is strange, but I am not all that surprised. The drive is a 4T NVMe in a Thunderbolt 3 enclosure. The drive has had zero errors and is very new. Every other file operation worked flawlessly on exFAT and APFS. The wine FRIM process is the only errors I had ever seen when using the drive.

I will update the script later today but I have converted two ISOs now that would not convert previously.

Would you be willing to format as exFAT again and confirm the issue is still present? That would eliminate a file system error (exFAT on Mac is not very good). I just want to figure out if I should say not compatible with exFAT or warn that filesystem issues may cause problems with the FRIM step.

I owned a company that had a couple stores. We serviced and sold refurbished Apple products. We often had exFAT issues on Mac and I had a Windows VM specifically for checking and repairing exFAT file systems.

Unfortunately, I cannot do that right now. I had already copied over 1.5T of movies to the new drive and started mass conversion, so I don't want to stop it right now and start from scratch. Perhaps you could give it a go on a smaller device with a single file and see if it fails? If not, I can get to it probably in a couple of weeks. I am going on a biz trip that will prevent me from doing it sooner.

I don't mind the testing and I have plenty of drives, but I want to use the same source material as you. It's ok, if someone else reports a similar issue, I will have them test. Thank you for figuring it out!