Hi,
Would it be possible to retrieve the first frame from a video file that is stored in a database by using imagemagick
through html code instead of using command line?
I have uploaded a video file such as mp4 to the database, however at website such as front page or list page, nothing will be shown since the video file is not image file (unless I run the actual video file at the detail page).
Can I do something with this by using ImageMagick through html code, not through command line? The below is the example of html code for video to run at the dtail page for html code, and is there any way to retrieve the first frame from a video file by using ImageMagick so that at the front page or the list page the image of the video file will be shown?
<video width="500" height="250" id="player" poster="xxxxx.jpg" controls="controls" preload="auto" >
<source src="xxxxxxxxxxxxxxxxxx" />
</video>
To retrieve the first frame from a video by using ImageMagick through html code.
-
- Posts: 26
- Joined: 2017-11-11T19:57:59-07:00
- Authentication code: 1152
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: To retrieve the first frame from a video by using ImageMagick through html code.
ImageMagick can retrieve a file via http. It runs in command line mode or using some API. It does not run via HTML. You can use PHP Imagick as the API to run imagemagick on a server. You can use PHP exec() or Imagick to retrieve the first page of the video, but then you need to pass that to PHP and HTML code to display it.
-
- Posts: 26
- Joined: 2017-11-11T19:57:59-07:00
- Authentication code: 1152
Re: To retrieve the first frame from a video by using ImageMagick through html code.
Thanks, fmw42.
I appreciate your information.
Now, I've tried the command line like below expecting for the mov file to be jpg file for testing purpose, and had an error like below. Can you tell me what is wrong with this?
[root@server-xxxxxxx-x ~]# convert /var/www/vhosts/xxxxxx.com/httpdocs/upload/save_image/test.mov /var/www/vhosts/xxxxxx.com/httpdocs/upload/save_image/test.jpg
convert: delegate failed `"ffmpeg" -v -1 -vframes %S -i "%i" -vcodec pam -an -f rawvideo -y "%u.pam" 2> "%Z"' @ error/delegate.c/InvokeDelegate/1057.
convert: unable to open image `/tmp/magick-0ow0GtKr.pam': No such file or directory @ error/blob.c/OpenBlob/2589.
convert: missing an image filename `/var/www/vhosts/xxxxxx.com/httpdocs/upload/save_image/test.jpg' @ error/convert.c/ConvertImageCommand/3015.
I appreciate your information.
Now, I've tried the command line like below expecting for the mov file to be jpg file for testing purpose, and had an error like below. Can you tell me what is wrong with this?
[root@server-xxxxxxx-x ~]# convert /var/www/vhosts/xxxxxx.com/httpdocs/upload/save_image/test.mov /var/www/vhosts/xxxxxx.com/httpdocs/upload/save_image/test.jpg
convert: delegate failed `"ffmpeg" -v -1 -vframes %S -i "%i" -vcodec pam -an -f rawvideo -y "%u.pam" 2> "%Z"' @ error/delegate.c/InvokeDelegate/1057.
convert: unable to open image `/tmp/magick-0ow0GtKr.pam': No such file or directory @ error/blob.c/OpenBlob/2589.
convert: missing an image filename `/var/www/vhosts/xxxxxx.com/httpdocs/upload/save_image/test.jpg' @ error/convert.c/ConvertImageCommand/3015.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: To retrieve the first frame from a video by using ImageMagick through html code.
Do you have the ffmpeg delegate installed with ImageMagick? It looks like ImageMagick does not find it.
look at the line starting with DELEGATES:
DELEGATES bzlib mpeg fftw fontconfig freetype gslib jbig jng jpeg lcms lqr lzma openexr openjp2 png ps rsvg tiff webp x xml zlib
Does your system list mpeg?
Code: Select all
convert -list configure
DELEGATES bzlib mpeg fftw fontconfig freetype gslib jbig jng jpeg lcms lqr lzma openexr openjp2 png ps rsvg tiff webp x xml zlib
Does your system list mpeg?
-
- Posts: 26
- Joined: 2017-11-11T19:57:59-07:00
- Authentication code: 1152
Re: To retrieve the first frame from a video by using ImageMagick through html code.
Thanks, fmw42.
I do not even know ImageMgaick is working for my env actually, and can you tell from the result?
[root@server-xxxxxxxx-x ~]# convert -list configure
Path: /usr/lib64/ImageMagick-6.7.2/config/configure.xml
Name Value
-------------------------------------------------------------------------------
CC gcc -std=gnu99 -std=gnu99
CFLAGS -fopenmp -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -pthread
CODER_PATH /usr/lib64/ImageMagick-6.7.2/modules-Q16/coders
CONFIGURE ./configure '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-shared' '--disable-static' '--with-modules' '--with-perl' '--with-x' '--with-threads' '--with-magick_plus_plus' '--with-gslib' '--with-wmf' '--with-lcms' '--with-rsvg' '--with-xml' '--with-perl-options=INSTALLDIRS=vendor CC='\''gcc -L/builddir/build/BUILD/ImageMagick-6.7.2-7/magick/.libs'\'' LDDLFLAGS='\''-shared -L/builddir/build/BUILD/ImageMagick-6.7.2-7/magick/.libs'\''' '--without-dps' '--without-included-ltdl' '--with-ltdl-include=/usr/include' '--with-ltdl-lib=/usr/lib64' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
CONFIGURE_PATH /etc/ImageMagick/
COPYRIGHT Copyright (C) 1999-2011 ImageMagick Studio LLC
CPPFLAGS -I/usr/include/ImageMagick
CXX g++
CXXFLAGS -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib fontconfig freetype gs jpeg jng jp2 lcms openexr png rsvg tiff x11 xml wmf zlib
DISTCHECK_CONFIG_FLAGS 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-dps=no --with-fontpath=
DOCUMENTATION_PATH /usr/share/doc/ImageMagick-6.7.2/
EXEC-PREFIX /usr
EXECUTABLE_PATH /usr/bin
FEATURES OpenMP
FILTER_PATH /usr/lib64/ImageMagick-6.7.2/modules-Q16/filters
HOST x86_64-redhat-linux-gnu
LDFLAGS -L/usr/lib64
LIB_VERSION 0x672
LIB_VERSION_NUMBER 6,7,2,7
LIBRARY_PATH /usr/lib64/ImageMagick-6.7.2
LIBS -lMagickCore -llcms -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lgomp -lpthread -lltdl
NAME ImageMagick
PCFLAGS -fopenmp
PREFIX /usr
QuantumDepth 16
RELEASE_DATE 2017-03-22
SHARE_PATH /usr/share/ImageMagick-6.7.2
SVN_REVISION exported
TARGET_CPU x86_64
TARGET_OS linux-gnu
TARGET_VENDOR redhat
VERSION 6.7.2
WEBSITE http://www.imagemagick.org
Path: [built-in]
Name Value
-------------------------------------------------------------------------------
NAME ImageMagick
I do not even know ImageMgaick is working for my env actually, and can you tell from the result?
[root@server-xxxxxxxx-x ~]# convert -list configure
Path: /usr/lib64/ImageMagick-6.7.2/config/configure.xml
Name Value
-------------------------------------------------------------------------------
CC gcc -std=gnu99 -std=gnu99
CFLAGS -fopenmp -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -pthread
CODER_PATH /usr/lib64/ImageMagick-6.7.2/modules-Q16/coders
CONFIGURE ./configure '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-shared' '--disable-static' '--with-modules' '--with-perl' '--with-x' '--with-threads' '--with-magick_plus_plus' '--with-gslib' '--with-wmf' '--with-lcms' '--with-rsvg' '--with-xml' '--with-perl-options=INSTALLDIRS=vendor CC='\''gcc -L/builddir/build/BUILD/ImageMagick-6.7.2-7/magick/.libs'\'' LDDLFLAGS='\''-shared -L/builddir/build/BUILD/ImageMagick-6.7.2-7/magick/.libs'\''' '--without-dps' '--without-included-ltdl' '--with-ltdl-include=/usr/include' '--with-ltdl-lib=/usr/lib64' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
CONFIGURE_PATH /etc/ImageMagick/
COPYRIGHT Copyright (C) 1999-2011 ImageMagick Studio LLC
CPPFLAGS -I/usr/include/ImageMagick
CXX g++
CXXFLAGS -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib fontconfig freetype gs jpeg jng jp2 lcms openexr png rsvg tiff x11 xml wmf zlib
DISTCHECK_CONFIG_FLAGS 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-dps=no --with-fontpath=
DOCUMENTATION_PATH /usr/share/doc/ImageMagick-6.7.2/
EXEC-PREFIX /usr
EXECUTABLE_PATH /usr/bin
FEATURES OpenMP
FILTER_PATH /usr/lib64/ImageMagick-6.7.2/modules-Q16/filters
HOST x86_64-redhat-linux-gnu
LDFLAGS -L/usr/lib64
LIB_VERSION 0x672
LIB_VERSION_NUMBER 6,7,2,7
LIBRARY_PATH /usr/lib64/ImageMagick-6.7.2
LIBS -lMagickCore -llcms -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lgomp -lpthread -lltdl
NAME ImageMagick
PCFLAGS -fopenmp
PREFIX /usr
QuantumDepth 16
RELEASE_DATE 2017-03-22
SHARE_PATH /usr/share/ImageMagick-6.7.2
SVN_REVISION exported
TARGET_CPU x86_64
TARGET_OS linux-gnu
TARGET_VENDOR redhat
VERSION 6.7.2
WEBSITE http://www.imagemagick.org
Path: [built-in]
Name Value
-------------------------------------------------------------------------------
NAME ImageMagick
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: To retrieve the first frame from a video by using ImageMagick through html code.
Your listing shows:
DELEGATES bzlib fontconfig freetype gs jpeg jng jp2 lcms openexr png rsvg tiff x11 xml wmf zlib
There is no mpeg. So that means that you need to install ffmpeg on your system.
DELEGATES bzlib fontconfig freetype gs jpeg jng jp2 lcms openexr png rsvg tiff x11 xml wmf zlib
There is no mpeg. So that means that you need to install ffmpeg on your system.