I distrust the force entrusted to the cantilevered horizontal pieces. I would run two pairs of vertical pipes - one against the wall with T-fittings. One side of the T attaches to the stud, the other side supports the shelf.
Maybe? Painted with crown moulding even? Pallet shelves. Make sure to check for HT (heat treated) stamp, not MB (some kind of chemical treatment). Also wash with vinegar or bleach or something to kill any little foreign travelers that might be hiding out.