Back when I was younger, I would say that we'd need to set higher standards in how those animals are treated and regulations. Here's the problem though; Factory farming isn't the problem of just a few greedy people, it's a problem with our society and Capitalism.
Businesses are nice because they offer convenience, but they are the absolute worst things imaginable when we try to ether hold them accountable for virtually anything or put them in a place of even the least bit of ethical responsibility. We cannot expect factory farms to ever treat animals well, because that's simply not how business works. If we ask them to follow any form of regulations, then this process will be a slow crawl at best. There standards will remain low, they'll still be completely dishonest about how they treat their animals, and minor things like 'PREGNANT CHICKENS CAN HAVE AN ADDITIONAL MILLIMETER OF SPACE!' Will continue to be headlined in animal rights websites as if it's an actual accomplishment. *Gasp*, really? Animals which are needlessly killed as a luxury can have an additional millimeter of space while they're giving birth? Wowee, PETA. That additional MM of space was totally worth all the bad stereotypes you gave the entirety of animal rights issues along with the endless marketing. That sure is our money at work.
You want corporations to stop butchering animals horrifically? Well, there's one way to end it; stop supporting them. Maybe you'd prefer to keep eating your meat and help out some local farmers which may or may not treat their animals well or maybe you'd like to be a vegan/vegetarian; but whatever the case factory farming is currently something which simply cannot be defended. Sentient life should not be put on an assembly line, and the grains which could have gone to starving families shouldn't go to animals which are slaughtered pointlessly for someone of our privilege that'll never have to worry about going hungry.
Don't like what any of my ideas, then well, just be lucky that I didn't take this a step further and propose that we go back to eating Long-pig.
A nice ban on the cruelty of livestock should be put into place. I am not asking for people to become vegan, they can keep their meat. A Balanced diet is the best diet.
More regulations should be set to be sure that animals get better living standards, such as grass and room to live. This might explode the price of meat.
However, it will help smaller farms sell more meat instead of the large factory " farms" .
Veganism is about much more than health--it's also a political stance. By refusing to buy meat or meat-related products, one is actively working to de-fund factory farms. Should this type of political action continue, factory farms will begin to lose their funding. I have already refused to purchase the equivalent of hundreds of animals. Right now around 2% of people in America are vegetarian. If we can double that population, millions of nonhuman animals will be saved from lives of torture and cruelty.
Scientists are working on growing meat in laboratories without having to kill the animals. When viable this should replace killing animals for meat.
This also has a government component. Ecologists and Zoologists should be funded to figure out how to undomesticate the animals and to find ecological niches where they will fit the best.