PHP rotate video - php

I have my own video sharing app,
My question is... is there any library,script or something else, to help me in rotating videos whatever their file extension is?
Many peoples are uploading videos but sometimes i found video (guessing shared with iphones or mobile phones) and i see them horizontally instead of vertically...
Does anyone have any ideas how to rotate them dynamically?

Im not familiar with any "libraries" that will do that. I think your better bet would be to find a command-prompt-enabled video software package (like Any Video Converter [See Q7]) that PHP can execute via command prompt on the fly.

PHP doesn't do that, and there are no extensions that I know off, made for that purpose.
You can use ffmpeg to manipulate videos, by calling it from your scripts (see shell_execute() and such functions). Reading the ffmpeg documentation will help you figure what can (and can't) be done with that powerful tool.

Related

PDF Thumbnailer

I am scratching my head with this one, how can you get a screenshot or a thumbnail of a PDF? I am developing a social feed on a web server I have no control over, there is a PDF class but I cant narrow down what it is, and theres no function in there for this task.
To do this serverside, you could use ImageMagick. This allows PDF's to be converted into images on the server, not having to depend on the client's browser to have certain software.
You do need to be able to install ImageMagick on the server though.
A link to a guide can be found here
You can use google docs
https://docs.google.com/viewer?a=bi&pagenumber=1&url=http://url-of-your-pdf.pdf
It returns a png of the first page, you can then edit it using Imagemagick or similiar
Idea from: How to create thumbnails/screenshots out of PDF files on my Linux server?

How do I capture an image from a SWF file?

I have searched the depths of the internet for a solution but unfortunately all the posts discussing the issue are outdated and provide no solutions.
I need to be able to dynamically generate a screenshot from a SWF file and save it locally to the server. Some posts suggest the use of FFMPEG, but I don't think it supports the SWF format. Another suggested to use the Internet Explorer grabscreen function, but that's Windows only.
Any answers on how to do this are greatly appreciated.
If you own a server, you can install extension for PHP (http://php.net/manual/en/swf.setup.php) however, this is a little overkill for getting one frame.
Other solution is using this class:
http://www.sephiroth.it/swfreader.php
Also, you can write your own parser, in this case refer to Adobes flasg format specification:
http://www.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf_file_format_spec_v10.pdf
If I understand you correctly you need to generate an image on server side. Please look at the solution described here: http://techblog.floorplanner.com/post/20528549445/server-side-png-rendering-of-swf-images-using-gnash
I didn't try it myself but hopefully it will help. Also if it is possible to generate an image after the first user opens the swf and there is a possibility to change the code of the SWF, I'd recommend you to look at this article: http://www.flepstudio.org/forum/tutorials/507-swf-png-actionscript-3-0-bytearray-class.html

generate images from swf

Is there any library/module available with which i can generate images from a swf file?
The problem i am trying to solve is: I want to create a pdf from a web page and i am having problems in doing that when the web page has swf (question in stackoverflow)
I am thinking if i am able to read a swf and write out an image, i will be able to solve the above the problem
Will appreciate your help, Thanks
In fact, that is quite a hard task. I've spent hours looking for a program that could fulfill such a task. However, I eventually only found one. It isn't open-source but would really help you I guess.
Flash Animation Source can output all frames of a SWF file. It uses a DirectShow filter to do so. Therefore, a Windows operating system is required should you not want to use WINE.
In short, you'll just need to install Flash Animation Source on your computer and then find a way to get DirectShow frames using your desired programming language. Everything else is actually quite easy. You tell Windows the directory and the name of your SWF file and it'll do the rest, thus delivering you with an image. And did you know DirectShow filters can deliver all frames of a video? Therefore, you can choose which one you'd like to have.
By the way, please don't try to find another way to get an image of your SWF file. Believe me, you won't find one. I have looked for an open-source program that fits my needs but all of them fail. You need to use the propriertary Adobe Flash player for your outputs. There is no other option as the open-source alternatives still need a lot of development to genuinely output the vector-based frame as it is.

RAW images and PHP

I would like to extract a thumbnail from a RAW image file, like Canon's .CR2 or Nikon's .NEF. I've understood that this can somehow be done with ImageMagick, but haven't grasped if it's possible through the PHP wrapper.
Are there any good solutions? Preferably using the built in thumbnail for speed.
Yep, iMagick (the php version of ImageMagick) can handle these extensions: http://www.imagemagick.org/script/formats.php
Here's a great set of tuts that got me going with Imagick. The owner responded to a few of my questions quickly, and despite a bit of a language barrier was able to easily get me through my hurdles
As an aside, I've begun using Gallery to do image admin. No need to worry about thumbnailing, uploading, etc....it's all automatic. Then on the front end I can do jquery magic (getting photos via php query from the gallery database tables) to make it look really good.
Likely, if PHP's imagemagick libraries are to support this, they would be drawing from some functionality exposed through imagemagick's 'identify' command line tool (as the tool would be itself exposing functionality in the imagemagick libraries). Looking at the documentation for this tool, it doesn't look good. If you tried running identify -verbose, theoretically, the thumbnail information would appear in there somewhere, perhaps as an encoded value. Try it yourself: if it does, maybe you could possibly further extract the information returned from identify, either through the imagemagick functions in PHP (though I don't see any past the Exif libraries which only work on JPEG), or by scraping the return of a PHP system call to the identify tool.
Either way, doesn't look likely.
Benjamin Horn has submitted a complete example about reading the requested data and even saving it locally for later use.
Check this out:
https://benjaminhorn.io/code/extracting-thumbnails-from-camera-raw-files-cr2-and-nef-with-php/

Use PHP or Flash to extract a frame from a video

The quick question: is there a pure PHP library that can extract a frame from the video to use as the thumbnail? I guess the answer is "no" but let me know if I am wrong :-) ffmpeg wrappers will not go, since I want this feature to work on most hostings without special PHP modules or binaries to launch.
There might also be some tool to do this on the client side with flash for example... This also acceptable. I'll just have to upload the flash-generated content to the server.
This script claims to be able to do it just by using GD

Categories