
Recherche avancée
Autres articles (85)
-
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...) -
L’utiliser, en parler, le critiquer
10 avril 2011La première attitude à adopter est d’en parler, soit directement avec les personnes impliquées dans son développement, soit autour de vous pour convaincre de nouvelles personnes à l’utiliser.
Plus la communauté sera nombreuse et plus les évolutions seront rapides ...
Une liste de discussion est disponible pour tout échange entre utilisateurs.
Sur d’autres sites (5263)
-
Run a Linux shell script using a file inserted by the user in Python
6 février 2017, par Georgе StoyanovI am trying to run a ffprobe command using a pre-defined by the user input file in Python. And then I will use the generated file by this command to report some parameters in a more organized view. My code is :
import subprocess
import json
cmd = "ffprobe -v quiet -print_format -show_format -show_streams /path/to/input/file.mp4 > output.json"
subprocess.call(cmd.split())
with open('output.json') as json_data:
data = json.load(json_data)
json_data.close()
d = float((data["streams"][0]["duration"]))
t = (data["streams"][0]["time_base"])
fps = [float(x) for x in t.split('/')]
print "==========================General=========================="
print "Name of the File: %s" %(data["format"]["filename"])
print "Duration: %.2f minutes" %(d/60)
print "Frame Rate: %d fps" %fps[1]
print "Bitrate: %.2f Mbps" %(float(data["format"]["bit_rate"])/1000000)I was thinking to use :
input_file = ("Please enter the path to your input file: ")
and then use the input_file in the ffprobe command on the second line of my code. But I am not sure how I can do it within the quotes. Please also note that the file name should also include an extension like input.mp4. -
How to convert ffmpeg shell script parameters to php ffmpeg code ?
27 mai 2024, par user2818066I want to convert a video to h.264 codec. I can run ffmpeg from shell successfuly using this command :


ffmpeg.exe -i C:/Users/fd/motorboat_org.mp4 -c:v libx264 -preset medium -crf 20 -c:a aac -b:a 160k -vf format=yuv420p -movflags +faststart C:/Users/fd/motorboat_2.mp4



How can I execute the same job in php ffmpeg using create method ? How to get my following code correct to do the job ?


function get_ffmpeg_exe_path_arr_def(){ 
 return( array( 'ffmpeg.binaries' => "C:/bin/ffmpeg.exe",
 'ffprobe.binaries' => "C:/bin/ffmpeg.exe",
 'timeout' => 3600000000, 'ffmpeg.threads' => 12
 ) ) ; 
}

$vid_inp = 'C:/Users/jd/motorboat_org.mp4' ; 
$vid_out = 'C:/Users/jd/motorboat_3.mp4' ; 
$ffmpeg = FFMpeg\FFMpeg::create( get_ffmpeg_exe_path_arr_def() );
$input = $ffmpeg->open($vid_inp);

$output = $input->addFilter('-c:v','libx264')
 ->addFilter('-preset','medium')
 ->addFilter('-crf','20')
 ->addFilter('-c:a','aac')
 ->addFilter('-b:a','160k')
 ->addFilter('-vf','format=yuv420p')
 ->addFilter('-movflags','+faststart')
 ->save($vid_out);

$ffmpeg->close();



The error message is :


Catchable fatal error: Argument 1 passed to FFMpeg\Media\AbstractVideo::addFilter() 
must be an instance of FFMpeg\Filters\FilterInterface, 
string given, called in C:\AppServ\www\app\upload_video.php 
on line 89 ( the '->save($vid_out);' line) and defined in 
C:\AppServ\www\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\Media\AbstractVideo.php on line 53



-
PHP memory issue when executing FFMPEG in CGI module but works from shell in CentOs
28 mai 2016, par sam rolfeI am trying to execute FFMPEG on my VPS server however it is failing due to memory problems. The PHP calls an shell_exec($cmd) on FFMPEG and this throws the memory allocation error. However if I call the exact same FFMPEG command from shell it works.
Even STRANGER is if I call the php script with the shell_exec($cmd) from shell - then it works.
I am sorry if I have not phrased this correctly. But I really feel as though this is a memory issue from the PHP being executed in the browser window via the CGI exe - as when it is run from within the shell it is obviously able to maintain the memory level. I am desperate to get this to work and have been researching all week.
I looked at system("ulimit -a") ;
core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 1546994 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 16384 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 400 virtual memory (kbytes, -v) 1048576 file locks (-x) unlimited file locks (-x) unlimited
The PHP is running as a suphp CGI I have set the php.ini memory to 2G, here are the details of things.
The basic command insude PHP
$cmd="ffmpeg -hwaccel auto -i finn.mp4 -y -pix_fmt yuv410p -s 320x240 -codec:v h264 -c:a copy -crf 20 -preset slow 0001_finn_test_2.mp4 null >/dev/null 2> ffmpeg_2.log &";
Output from error log - I can not post the full log as the formatting will not work :
ffmpeg version N-80079-g4c82cca-vps15452_20160524 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
configuration: --prefix=/usr --extra-version=vps15452_20160524 --enable-shared --enable-static --enable-libx264 --enable-libass --enable-fontconfig --enable-libfreetype --enable-gpl --enable-nonfree --enable-version3 --enable-libmp3lame --enable-libvpx --enable-libspeex --enable-libwebp --enable-libfaac --enable-libtheora --enable-libvorbis
libavutil 55. 24.100 / 55. 24.100
libavcodec 57. 43.100 / 57. 43.100
libavformat 57. 37.100 / 57. 37.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 46.100 / 6. 46.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'finn.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2016-01-28 09:16:38
Duration: 00:00:29.93, start: 0.000000, bitrate: 17060 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 16991 kb/s, 30.01 fps, 30 tbr, 90k tbn (default)
Metadata:
creation_time : 2016-01-28 09:16:38
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
Metadata:
creation_time : 2016-01-28 09:16:38
handler_name : SoundHandle
Incompatible pixel format 'yuv410p' for codec 'libx264', auto-selecting format 'yuv420p'
[libx264 @ 0x2560c60] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x2560c60] profile High, level 1.3
[libx264 @ 0x2560c60] 264 - core 148 r2694 3b70645 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=7 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x255ed00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, mp4, to '0001_finn_test_2.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf57.37.100
Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 320x240, q=2-31, 30 fps, 15360 tbn (default)
Metadata:
creation_time : 2016-01-28 09:16:38
handler_name : VideoHandle
encoder : Lavc57.43.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 256 kb/s (default)
Metadata:
creation_time : 2016-01-28 09:16:38
handler_name : SoundHandle
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264 @ 0x29478c0] decode_slice_header error
[h264 @ 0x29478c0] no frame!
[h264 @ 0x298eb60] Cannot allocate memory.
[h264 @ 0x298eb60] Could not allocate memory
[h264 @ 0x298eb60] h264_slice_header_init() failedError while decoding stream #0:0: Cannot allocate memory
[h264 @ 0x298eb60] Cannot allocate memory.
[h264 @ 0x298eb60] Could not allocate memory
[h264 @ 0x298eb60] h264_slice_header_init() failedError while decoding stream
[h264 @ 0x298eb60] h264_slice_header_init() failedError while decoding stream #0:0: Cannot allocate memory
Error writing trailer of 0001_finn_test_2.mp4: Cannot allocate memoryframe= 0 fps=0.0 q=0.0 Lsize= 1kB time=00:00:09.07 bitrate= 0.8kbits/s speed= 103x
video:0kB audio:284kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!