Oh, that's bad firmware avoid doing a factory reset as you can get it working without losing data (factory reset most of the time wont work when it boot loops on animated samsung logo like that.)
You will need to reflash the firmware on that phone using ODIN flasher if you want to keep the data.
Download the Samsung Firmware from here:
To choose the correct firmware, compare the CSC code (Region / Carrier) that is displayed in the recovery menu:
To boot recovery mode on the phone, take battery out (wait 5 seconds) or force turn phone off via power + volume down for 8-10 seconds then quickly hold power and volume up until it shows (vibrates and shows samsung logo) It will most likely say booting recovery. Let it boot and you will see it display what I said hopefully. Firmware build version information is displayed at top of recovery menu if you want to keep note of it, it's useful to know to help identify which firmware is best for your phone.
It will print in the recovery menu applied CSC code OPS or something like that.
Once you have downloaded the correct firmware, you will need to open up odin
Good instructions on how to use odin are here:
Alternatively you can use Samsung Smart Switch to identify which firmware is right for your phone:
1. Open up smart switch after downloading and installing it:
For below check the back of the phone / behind battery for S/N and IMEI.
2. Enter Model Number (Use capitals):
3. Enter Serial Number:
4. The software should display something like this:
(BTU) is the region code to identify which region firmware you need for your device, just make sure to use latest one to avoid issues with flashing older firmware than the one you already have on your device.
But don't use smart switch or samsung kies to flash firmware on phone if you want to keep data though.