gimli2 / sigal

It is a free photo gallery written in PHP. This script inspired by simplicity of brilliant MySQL client Adminer from Jakub Vrána. It is completely in only one file. It is very simple to upload it anywhere to hosting and use it in a few seconds. And why don't use this idea for web photo gallery?
Other
2 stars 3 forks source link

func_videoimage, func_avfileplay #13

Closed dmahurin closed 9 years ago

dmahurin commented 9 years ago

function to get video image (for thumbnails). function to convert/play video files (assumes mp4 needs no conversion). Perhaps that should be configurable (mp4 or webm).

gimli2 commented 9 years ago

Is any reason to use: 0 != strcmp($str1, $str2) instead of $str1 !== $str2 when you doesn't need to know which string is grater?

Why to use own implementation of range download when common servers support it for static content - in our case it is temporary mp4 videofile in SHM?

Using of /dev/shm forces usage only to UN*X systems. But I Think that is for the optional extension acceptable.

I am not sure that vcodec copy is enough for creating webbroser playable mp4. It only rewrap original codec to mp4 container. It should be checked.

It is quite strange to merge video extensions to that from which icons will be made: $gg->extsIcon = array_merge($gg->extsIcon, $gg->extsVideo); and next again seperating it: if (in_array($ext, $this->extsIcon) && !in_array($ext, $this->extsVideo)) {...

dmahurin commented 9 years ago

Is any reason to use: 0 != strcmp($str1, $str2) instead of $str1 !== $str2 when you doesn't need to know which string is greater?

Not really. Perhaps another language habit... I rebased the pull request. Now it is !==.

Why to use own implementation of range download when common servers support it for static content - in our case it is temporary mp4 videofile in SHM?

The static content (generated file) is never reference directly). It is played dynamically through "?avfile=" (and showVideo() ), It this case range download must be implemented, afaik (playing without HTTP_RANGE logic did not work). Of course, this is just an example implementation (that works for my home server use case). Another implementation could generate to the cache directory, and redirect to there.

Using of /dev/shm forces usage only to UN*X systems. But I Think that is for the optional extension acceptable.

Yes, I suppose the cache directory could also be used for this. In my case, I really wanted these to be temporary, not fill up disk space, and in this case, never write to disk at all. But, I guess this depends on the use. On a public website, you probably want to cache all video conversions (and not delete them like I am doing). So this is just one possible/example implementation of the function.

I am not sure that vcodec copy is enough for creating webbroser playable mp4. It only rewrap original codec to mp4 container. It should be checked.

Yes, it depends on the content. Works for .mov and Sony mts. Just because both use h264 for video.

I tried possibly converting video to webm, depending on browser, but this takes a long... time, and is not suitable for on-the-fly conversion. Only audio could be converted within a few seconds.

Again, another implementation of the func_avfileplay may be better in other use cases.

It is quite strange to merge video extensions to that from which icons will be made: $gg->extsIcon = array_merge($gg->extsIcon, $gg->extsVideo); and next again seperating it: if (in_array($ext, $this->extsIcon) && !in_array($ext, $this->extsVideo)) {...

I had to look back to remember what I did there: My logic works as follows:

if func_videoimage is defined, then I add all the extsVideo to extsIcon, as we assume that the function can generate thumbnails for all videos.

So in most all cases, we act like video extensions are in the icon extensions.

The one case where we don't wan't the video extension to match as an extsIcon is in 'getMiddleName', as this would result in the showing the middle image of the video, rather than playing it. That is the second line you mentioned. (if in exsIcon and not in extsVideo).

I tried a couple different ways of doing this, including adding other exts lists, but this implementation seemed the simplest.