Home > ROMs > Stock Firmware

How to Extract OZIP Realme Stock ROM (Firmware)

In this tutorial, we will show you how to extract Realme Stock Firmware that comes in OZIP format. It hasn’t been long since the OEM has set its foot into India. But it is indeed quite commendable how it has managed to gather such a large fanbase in a short period. Offering feature-rich devices at an affordable price, well what else could one have asked for. Furthermore, it is quite rich in the custom development scenario.

realme extract rom firmware ozip

From unlocking the bootloader to gaining administrative privileges in the form of the root, there exists a plethora of such tips and tricks.  Along the same lines, there is no dearth of custom ROMs as well. As of now, rooting Realme devices seems to have generated maximum hype. In this regard, there exist two different ways of achieving root- via TWRP and without TWRP. The first one is pretty simple- just flash the Magisk Installer ZIP via TWRP Recovery and you will have achieved root.

The second method involves extracting the stock boot image file, patching it via Magisk, and then flashing the patched boot.img file via Magisk. And it is the latter in which most of the users seem to be interested in. But for that, you will need to extract the Realme stock firmware that comes in OZIP format. But first let’s check out why this need arises in the first place, after which we will list out the steps to extract the stock boot.img file from the Realme OZIP firmware package. Follow along.



Everything to Know About OZIP Realme Stock Firmware

So here is the thing. Earlier the OEMs used to pack in the stock firmware in just a ZIP package. All that was needed is to simply extract that ZIP package and you could then easily get a hold of boot, vendor, vbmeta among other partition files. However, all this has now changed. OEMs like OnePlus and Google now pack all their firmware contents inside the payload.bin.

extract ozip realme python

On the other hand, Realme packs its stock firmware in the OZIP format. So if you wish to root your device without using TWRP, then you will have to first extract this OZIP package. But this isn’t any normal file that you could extract via WinZIP or WinRAR. For this, you will have to make use of Python and the Ozipdecrypt file.

Once you decrypt the OZIP firmware using both these tools, you will then be presented with the stock firmware ZIP file. This could then easily be extracted via WinZIP or WinRAR. and then you could get your hands on the required files, including stock boot image. We will then patch this stock boot.img fi,e via Magisk, and then flash it via fastboot commands. Here are all the instructions related to how to extract the OZIP Realme Stock Firmware file using Python. Follow along.

How to Extract OZIP Realme Stock Firmware

To begin with, there are a couple of requirements that your device needs to satisfy. Make sure to download the files from the below section before proceeding with the steps.

Downloads

  • First and foremost, download and install Python on your PC. The installation isn’t difficult, just follow the on-screen instructions that appear and it should be installed within minutes.
  • Next up, download the Ozipdecrypt tool from GitHub. To download it from GitHub, you will have to click on the Code button and then click on the Download ZIP button.
    download zip
  • Finally, download your Realme device stock firmware. It will be in the OZIP format.

Once you have downloaded all these files, proceed with the below steps to extract the OZIP Realme Stock Firmware.

STEP 1: Setting up the Working Environment

  1. Install Python onto your PC. The installation isn’t difficult, just follow the on-screen instructions and the process should be completed within minutes. It is recommended (not compulsory though) not to change the installation directory.
    python setup

    So, if you have chosen the default directory, then the installation directory will be C:\Users\YOURNAME\AppData\Local\Programs\Python\Python37-32. Keep this location in mind.

  2. Next up, extract the downloaded Ozipdecrypt tool inside the same folder where Python is installed. There should be four files within it- .gitignore, README.md, ozipdecrypt.py, and requirements.txt file. Make sure you place all these four files inside the Python installation folder.
  3. Finally, place the Realme stock firmware (in OZIP format) within the Python folder as well. So now, the Python folder will have the Python files, four Ozipdecrypt files, and an OZIP stock firmware.
TIP: Rename the stock ROM to something shorter, as we will have to input the same name later on in the command prompt. We have named the firmware file to Realme, hence the complete name becomes Realme.ozip.

 



STEP 2: Launch CMD Window

Head over to the folder where you have installed Python. If you haven’t changed the installation directory, then the location will be C:\Users\YOURNAME\AppData\Local\Programs\Python\Python37-32. Inside the folder’s address bar, type in CMD and hit Enter. This will launch the Command Prompt.

python cmd window

You could also launch Command Prompt from Start menu as an admin and then type ic CD followed by the Python installation directory. In our case, it will be CD C:\Users\YOURNAME\AppData\Local\Programs\Python\Python37-32. For ease, we would take the first route, i.e. directly opening CMD inside the Python folder only.

STEP 3: Install Pycryptodome via CMD

Copy-paste the below command in the opened CMD window to install Pycryptodome:

python -m pip install pycryptodome

pycryptodome installed

STEP 4:  Install Docopt via CMD

Now copy-paste the following command inside the same CMD window to install Docopt:

python -m pip install docopt

docopt

STEP 5: Extract Realme OZIP Stock ROM (Firmware)

Finally, execute the below command in the same CMD window to extract the Realme OZIP firmware package.

python ozipdecrypt.py realme.ozip

Since we have named the stock ROM as Realme, hence the above command. Make sure to modify the code accordingly as per the name of your Realme firmware file.

extract ozip realme rom

You should then see the message as

Found correct AES key: your_key
Decrypting…
Done!!

how to convert ozip firmware to zip

As soon as you see the above message, you should see the Realme stock firmware file in the ZIP format placed inside the same Python folder. In our case, this folder is C:\Users\YOURNAME\AppData\Local\Programs\Python\Python37-32.



STEP 6: Extract Realme Boot.img Image File

realme stock boot image file

You could now simply extract the Realme stock ZIP firmware that you have got by executing the above steps. Take the help of the WinRAR or WinZIP software and extract the desired file/files. For this guide, we will only be needing the stock boot.img. So extract it to a convenient location and that’s all! You could now proceed ahead with rooting your device by taking the help of the following guides:

With this, we conclude the guide on how to extract OZIP Realme Stock ROM or Firmware file. If you have any issues with respect to any of the aforementioned steps, do let us know in the comments section.

How to Extract .DAT.BR from OZIP Firmware

As you might have noticed, upon executing the above steps, you got the stock boot.img file in IMG format. This could be flashed via Fastboot Commands. But what about other partition files? Well, other files such as system, vendor, etc are in .dat.br format, which cannot be directly flashed via Fastboot.

unpack-ozip-to-img

So how could you convert it to Fastboot flashable IMG format? Well, if you wish to do so, then please refer to this guide: How to Extract Fastboot Images from Realme/Oppo OZIP Firmware. The benefit of this conversion? If you end up bricking your device, then you could manually flash all the partition files via Fastboot Commands.

User Requested Realme Stock Boot.img Extracted from OZIP

Some users were facing issues in carrying out the decryption, so I extracted the OZIP firmware and uploaded the stock boot.img file. Here’s the direct link for the same. Double-check that the device, as well as the software version, are exactly the same.

Once downloaded, rename it to boot.img and then flash it via Fastboot Commands. Furthermore, you may request for your device as well in the comments section. Just make sure to list out the complete information (software version as well). I download the firmware from Realme’s official page [link], so please follow the filename format is given there. Rounding off, I may not guarantee the exact time frame for the file upload, it might even take up to a week (since I am the sole maintainer of this site) so apologies for the same in advance!

Share:
  • Hi ..

    Can U Pls help me with the img file of Realme 5 pro.. I tried the above method but facing the errors..

  • Hello, can you upload the realme 7 pro Global ozip. Realme Stock Boot.img .Thank you

  • FOR THOSE WHO ARE HAVING ERRORS FROM:
    Detected mode 2….
    Finding key… realme.ozip
    Unknown mode2, boot.img wasn’t encrypted
    Extracting… realme.ozip
    Traceback (most recent call last):
    File “C:\Users\name\AppData\Local\Programs\Python\Python310\ozipdecrypt.py”, line 258, in main
    if zo.extract(‘oppo_metadata’, outpath):
    ….
    HERE ARE THE STEPS TO FIX THIS:
    1. Right click the ozipdecrypt.py, and open it with notepad++ (you can use other source code editor that shows the lines of codes on the left. notepad alone is not recommended)
    2. Go to line 208 and you will see:
    os.remove(os.path.join(temp,”out”))
    3.To fix the problem, simply add # to it to make it as a comment and turn it into something like this:
    # os.remove(os.path.join(temp,”out”))
    4. This will fix the problem

    • Christian

      After I put “# ” in line 208 , I got a new error “python.exe: can’t open file ‘C:\\Users\\Kevin\\AppData\\Local\\Programs\\Python\\Python311\\ozipdecrypt.pyRrealme.ozip’: [Errno 2] No such file or directory”

  • Partha Sarathy Dash

    its show oppo_metadata not found in archive

  • Hi Mr. Hassan, kindly assist with my device please.
    Model: oppo A12 CPH2083EX_11_A.65
    I get an error running the command python -m pip install pycryptodome
    please assist with the boot.img

  • hello sir, suddenly while iam trying to change from experience ui to realme ui in my real me 3 pro mobile i have unexpectedly deleted the vendor now the phone is starting continuously iam not able to use it…. could you please help me os to get installed in my mobile… only twrp is opening recovery mode… that also unable to flash ozip format files please help me sir …

  • Bro, I did everything as said but it said, “There is no item named ‘OPPO metadata’ in the archive” and a bunch of other things. Pls help.

  • Viol Voldegort

    Bro help me extract CPH1853EX_11_A.39 boot image its in ozip file

  • Please extract all the image file of realme c15 for me, cause I am not able to do.
    Thanks in advance

  • Hello, can I request a recovery.img file for realme 3 pro version RMX1851EX_11.C.18 so that I can unlock the ramdisk? Thanks.

  • Hello, can I request a recovery.img file for realme 3 pro? Thanks.

  • WindowsError: [Error 32] The process cannot access the file because it is being used by another process

  • Can you help decrypt the OZIP for RMX1971EX? Doesn’t work for me.

  • oplus verify fail
    need to verify signature of another brand
    oplus verify pass
    fastboot verify success
    fastboot_unlock_verify ok

    how to fix this?

    • Sadique Hassan

      So you are getting this error while trying to unlock the device’s bootloader? If yes, then let me know the device name as well.

      • Mohammed elsaid

        I got the same error when I Tried to unlock bootloader for my realme c25s. I used the deep testing tool but my bootloader still locked 😭, can you help me!

  • C:\Users\Reguram\AppData\Local\Programs\Python\Python39>python ozipdecrypt.py realme.ozip
    ozipdecrypt 1.31 (c) B.Kerler 2017-2021
    “There is no item named ‘oppo_metadata’ in the archive”
    Detected mode 2….
    Finding key… realme.ozip
    Unknown mode2, boot.img wasn’t encrypted
    Extracting… realme.ozip
    Traceback (most recent call last):
    File “C:\Users\Reguram\AppData\Local\Programs\Python\Python39\ozipdecrypt.py”, line 258, in main
    if zo.extract(‘oppo_metadata’, outpath):
    File “C:\Users\Reguram\AppData\Local\Programs\Python\Python39\lib\zipfile.py”, line 1616, in extract
    return self._extract_member(member, path, pwd)
    File “C:\Users\Reguram\AppData\Local\Programs\Python\Python39\lib\zipfile.py”, line 1655, in _extract_member
    member = self.getinfo(member)
    File “C:\Users\Reguram\AppData\Local\Programs\Python\Python39\lib\zipfile.py”, line 1429, in getinfo
    raise KeyError(
    KeyError: “There is no item named ‘oppo_metadata’ in the archive”

    Bro Iam Using Realme 2 (RMX1809).Pls help

  • C:\Users\Abinesh\AppData\Local\Programs\Python\Python39>python ozipdecrypt.py realme.ozip
    ozipdecrypt 1.31 (c) B.Kerler 2017-2021
    “There is no item named ‘oppo_metadata’ in the archive”
    Detected mode 2….
    Finding key… realme.ozip
    Unknown mode2, boot.img wasn’t encrypted
    Extracting… realme.ozip
    Traceback (most recent call last):
    File “C:\Users\Abinesh\AppData\Local\Programs\Python\Python39\ozipdecrypt.py”, line 258, in main
    if zo.extract(‘oppo_metadata’, outpath):
    File “C:\Users\Abinesh\AppData\Local\Programs\Python\Python39\lib\zipfile.py”, line 1616, in extract
    return self._extract_member(member, path, pwd)
    File “C:\Users\Abinesh\AppData\Local\Programs\Python\Python39\lib\zipfile.py”, line 1655, in _extract_member
    member = self.getinfo(member)
    File “C:\Users\Abinesh\AppData\Local\Programs\Python\Python39\lib\zipfile.py”, line 1429, in getinfo
    raise KeyError(
    KeyError: “There is no item named ‘oppo_metadata’ in the archive”

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File “C:\Users\Abinesh\AppData\Local\Programs\Python\Python39\ozipdecrypt.py”, line 317, in
    sys.exit(main(args.filename))
    File “C:\Users\Abinesh\AppData\Local\Programs\Python\Python39\ozipdecrypt.py”, line 265, in main
    return mode2(filename)
    File “C:\Users\Abinesh\AppData\Local\Programs\Python\Python39\ozipdecrypt.py”, line 208, in mode2
    os.remove(os.path.join(temp,”out”))
    PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: ‘C:\\Users\\Abinesh\\AppData\\Local\\Programs\\Python\\Python39\\temp\\out’

  • Realme x2 pro. RMX1931 (IN)
    All my sensors were not working because i accidentally flashed vbmeta.img to persist partition using twrp.

    So i took persist partition of some other realme x2 pro and flashed it. My sensors are now working fine except fingerprint.

    Tried.
    1. Flashed stock rom (ozip and ofp)
    2. Flashed android 9
    3. Took it to service center for calibration. They said 3 test (that is yellow rubber) fails
    4. Tried to calibrate it myself
    5. Rooted the device to fix partition files but couldn’t find exact folders in persist partition.

    Question:
    How to get persist.img file?
    Is it unique for ever device?
    Is service center themself couldn’t fix it, what’s my next hope?
    Why only fingerprint broke?

    Please help.

  • Ajay sahani

    ofp file for realme xt

  • Hello. I tried this method but somehow i got 2(or 3?) errors
    – Finding key… C:\Users\Administrator\Downloads\realme.ozip
    Unknown mode2, boot.img wasn’t encrypted
    – KeyError: “There is no item named ‘oppo_metadata’ in the archive”
    – PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: ‘C:\\Users\\Administrator\\Downloads\\temp\\out’
    i downloaded file from realme official site and turn out it was OTA packages, i searched for entire firmware file but i cant find it. what i can found is a firmware file with .ofp format that must be used with msmdownloadtools, which that tools need an account and password that i dont have.

    can you extract the boot.img for me? my device is Realme C1

    thank you

  • Debdut Majumder

    C:\Users\DEBDUT MAJUMDER\AppData\Local\Programs\Python\Python39>python ozipdecrypt.py realme.ozip
    ozipdecrypt 1.31 (c) B.Kerler 2017-2021
    Traceback (most recent call last):
    File “C:\Users\DEBDUT MAJUMDER\AppData\Local\Programs\Python\Python39\ozipdecrypt.py”, line 317, in
    sys.exit(main(args.filename))
    File “C:\Users\DEBDUT MAJUMDER\AppData\Local\Programs\Python\Python39\ozipdecrypt.py”, line 255, in main
    with zipfile.ZipFile(filename, ‘r’) as zo:
    File “C:\Users\DEBDUT MAJUMDER\AppData\Local\Programs\Python\Python39\lib\zipfile.py”, line 1257, in __init__
    self._RealGetContents()
    File “C:\Users\DEBDUT MAJUMDER\AppData\Local\Programs\Python\Python39\lib\zipfile.py”, line 1324, in _RealGetContents
    raise BadZipFile(“File is not a zip file”)
    zipfile.BadZipFile: File is not a zip file

    I got this error. Can u help ??

    • Sadique Hassan

      Hi Debdut, judging by the error, the issue seems to be with the ZIP file itself. You would have to re-download the entire file and then re-try with the process.