The drive from Stryi to Chop at the border looks to be 3 or 4 hours. There is a straight through train to Budapest late afternoon that will get you to Budapest in a little more than 5 hours. So, I am guessing with all the hassle it would be a 10 hour trip.
I looked up Lviv to Budapest MAV site. Lviv is an hour drive in the wrong direction but …. From Lviv it’s a 12:51 trip with one train change and a 2 hour layover (at the border); add to that at least an hour to arrive at the station early and figure out the ticket issues. So realistically, maybe 15 hours total including a drive to Lviv.
Lvov 06:46 81 (Kiev-Passajirskii - Chop) Kiev-Passajirskii --
Budapest-Nyugati közvetlen kocsiban Chop 12:12 through carriage
Chop 14:20 későbbi továbbutazás 33 LATORCA NIC ( -
Budapest-Nyugati) Kőbánya-Kispest 18:20 Zugló 18:28
Budapest-Nyugati 18:37
To fly, figure 3 hours to get to the airport in Lviv and early check in, then from the airport in Budapest figure half an hour to get to town, so you start out 3.5 hours plus flight time. Flights take anywhere from 4 to 8 hours depending on the day of the week. Using the one in the middle the entire trip would be about 10 hours. Of course this is what I would do, but I would spend the night at the very least in Kyiv and see some of my favorite city. That’s sort of what I am doing for Christmas: Budapest to Kyiv, Kyiv for a few days. Kyiv to Lviv for a few days, then back to Budapest on the nonstop services that starts in November.
One way flight in 6:40 with a change in Kyiv for $89.00
8:50 AM – 10:00 AM Lviv (LWO) – Kiev (KBP) Ukraine 38 · Economy Class
· Boeing 737 1h 10m Layover in Kiev KBP 3h 35m 1:35 PM – 2:30 PM Kiev
(KBP) – Budapest (BUD) Ukraine 813 · Economy Class · Boeing 737 1h 55m