Well, you do seem to have the answer in your hands! It's the cable! If you use the same charger with a different cable and it works fine, but go back to the original cable and it doesn't, well... it must be the cable, right?
It COULD be the USB port going faulty (it's known to happen... I know I had to replace mine in the S2 and my friend's S3 in the past), but if that were the case, it would be the same with every cable and charger, no matter what.
If you want to be super sure, try using the same charger and cable (the ones that fail in yours) with another S4; if it's the cable, it will show the same error in the second unit. Also, if you were able to find another S4, ask for their charger as well... if their charger/cable works fine with yours, your port is OK.
And it's also a good idea to brush the port every once in a while (preferably while the phone is OFF); any clean, dry toothbrush should do the trick, but if you have one of those compressed air cans, that's even better (and so much more fun!).
Oh, and another thing! Very long cables, if not very high quality (read: very generic ones) tend to have current losses due to to the sheer length, so a cheap cable that runs too long will also tend to charge your phone a lot slower.
12-17-2013 09:54 PM