Question: I have a list of families where each family - on rollover - display a tooltip with additional information about individual family (living place info and 3 images of that place).

So what is the best practice (performance) to do? To preload all the data at the beginning or to ajax request data only when needed (on rollover)?

Note that page already includes 3 select mysql\_queries, and data fetch for tooltip requires another 2.

***Queries (for the idea of search complexity):***

**Original 3 queries:**

```
SELECT * FROM news ORDER BY bDate DESC LIMIT 5;
SELECT * FROM family ORDER BY created DESC LIMIT 5;
SELECT bplace.placeID, bplace.sName, bplace.countryID, bcountry.regionID FROM bplace, bcountry WHERE bplace.countryID = bcountry.countryID ORDER BY created DESC LIMIT 5;

```

**Tooltip 2 queries (preload way):**

```
while(...){

$allFamilies[] = $row["familyID"];

}

$allFamilies = implode(',',$allFamilies);

SELECT sName FROM bplace WHERE placeID IN ($allfamilies);
SELECT url FROM images WHERE placeID IN ($allfamilies);

```

**Tooltip 2 queries (ajax way):**

```
SELECT sName FROM bplace WHERE placeID='1';
SELECT url FROM images WHERE placeID='1';

```

Answer: 
I know this is very old but as i came across and found no other reliable answer and after some more testing:

The suggestion with checking for return of 0 is in general a good advice - but does not help in all cases. The other idea with checking if the file exists is also good - but again - does not help in all cases.

For example when the input file is a mp3 file that has an embedded cover - then ffmpeg does (in my tests) use this image and extracts that one as an (unusable) video file.

What i do now is to have debug level output and parse it for the number of muxed packets.

`ffmpeg -i "wildlife.mp4" -c:v copy -an -sn "out.mp4" -y -loglevel debug 2> wildlife.txt`

With a regex i search for this text:  

`Output stream .+ (video): [0-9][0-9]+ packets muxed \([0-9][0-9]+ bytes\)`

(this assumes that every video has more than 9 packets - could of course be optimized for really short videos).

Of course for RTMP or other settings the output may differ but i think to parse the full output stream is the only option.
You could just check the exit code returned by ffmpeg. It should return 0 on success, anything else means it failed.