A California fire department says a little white dog named Jack is recovering after firefighters rescued him from a burning home and brought him back to life.

In a video posted to the Bakersfield Fire Department's website that has been widely shared online, firefighter Matt Smith is shown carrying the nearly lifeless Shih Tzu from the house on Wednesday.

Using a pet oxygen mask donated to the department by a local Girl Scout troop, Smith and his partners slowly bring Jack back to life.

By the end of the video, Jack is sitting up, alert and looking around, though panting heavily. He was then reunited with his worried owners, a married couple who were unharmed by the fire.

Jack suffered respiratory tract injuries and burns to his feet, but the dog was doing well on Friday after receiving extensive oxygen therapy, department spokesman John Frando said.

Frando, who shot the video of Jack's rescue, said it looked so dire for the pooch that at one point he stopped recording.

"I thought Jack was going to die," he said. "He was in really bad shape."

Frando said Smith found Jack behind a couch in the home, which was billowing with smoke by the time they arrived. Smith and Jack were reunited Thursday at the veterinary hospital where he was being treated.

In a Facebook post published on the Bakersfield Fire Department page, Smith thanked local Girl Scouts Hailey Amos and Kylie Greene for the life-saving gifts.

In 2015, the girls from Troop 376 raised about $2,000 to buy 27 pet oxygen mask kits for each of the Bakersfield and Kings County fire trucks. The duo earned the Girl Scout Silver Award for their effort.

"It was the perfect project for us because we got to help all animals, and we love animals, and we got to help the fire department," Greene told Bakersfield.com at the time.

