
Recherche avancée
Autres articles (46)
-
Utilisation et configuration du script
19 janvier 2011, parInformations spécifiques à la distribution Debian
Si vous utilisez cette distribution, vous devrez activer les dépôts "debian-multimedia" comme expliqué ici :
Depuis la version 0.3.1 du script, le dépôt peut être automatiquement activé à la suite d’une question.
Récupération du script
Le script d’installation peut être récupéré de deux manières différentes.
Via svn en utilisant la commande pour récupérer le code source à jour :
svn co (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Configuration spécifique d’Apache
4 février 2011, parModules spécifiques
Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
Création d’un (...)
Sur d’autres sites (4778)
-
Convert a video with content type video/quicktime to video/mp4 using ffmpeg
25 juin 2021, par schubI have a strange problem. I start with a video file recored with an iPhone. The output is
video.mov
. I convert this to mp4 using ffmpeg :

ffmpeg -i video.mov -vcodec h264 -acodec aac video.mp4


If I use a tool like exiftool to show the metadata the output for
content-type
isvideo/mp4
all seems to be correct. But my backend, which receives the video, uses a library called Apache Tika to extract the content type and the result here is :video/quicktime
.

Scala code to retrieve the content type from the file :


// byteArray: Array[Byte]

val tika = new TikaConfig()
val metadata = new Metadata()
val contentType = tika.getDetector.detect(TikaInputStream.get(byteArray), metadata)



BTW : If I use a video editing program (DaVinci Resolve in my case) I can load the video, adjust settings and explicitly set the codec to mp4, export the video and then the resulting file works and Apache Tika extract the desired content-type. This is a workaround, but it does not scale and I like to automate this process via ffmpeg.


I'm stuck here. Can anyone give me a hint what I can do ?


Versions :


tika : 1.22

ffmpeg : 4.4

ffmpeg log :


$ffmpeg -i video.mov -vcodec h264 -acodec aac video.mp4
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
 built with Apple clang version 12.0.0 (clang-1200.0.32.29)
 configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
 libavutil 56. 70.100 / 56. 70.100
 libavcodec 58.134.100 / 58.134.100
 libavformat 58. 76.100 / 58. 76.100
 libavdevice 58. 13.100 / 58. 13.100
 libavfilter 7.110.100 / 7.110.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 9.100 / 5. 9.100
 libswresample 3. 9.100 / 3. 9.100
 libpostproc 55. 9.100 / 55. 9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mov':
 Metadata:
 major_brand : qt
 minor_version : 0
 compatible_brands: qt
 creation_time : 2021-06-24T11:19:37.000000Z
 com.apple.quicktime.location.accuracy.horizontal: 65.000000
 com.apple.quicktime.location.ISO6709: +52.5554+013.3772+042.268/
 com.apple.quicktime.make: Apple
 com.apple.quicktime.model: iPhone 8
 com.apple.quicktime.software: 14.4.2
 com.apple.quicktime.creationdate: 2021-06-24T13:19:36+0200
 Duration: 00:00:09.83, start: 0.000000, bitrate: 7954 kb/s
 Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 1920x1080, 7810 kb/s, 30.01 fps, 30 tbr, 600 tbn, 600 tbc (default)
 Metadata:
 rotate : 90
 creation_time : 2021-06-24T11:19:37.000000Z
 handler_name : Core Media Video
 vendor_id : [0][0][0][0]
 encoder : HEVC
 Side data:
 displaymatrix: rotation of -90.00 degrees
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 96 kb/s (default)
 Metadata:
 creation_time : 2021-06-24T11:19:37.000000Z
 handler_name : Core Media Audio
 vendor_id : [0][0][0][0]
 Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
 Metadata:
 creation_time : 2021-06-24T11:19:37.000000Z
 handler_name : Core Media Metadata
 Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
 Metadata:
 creation_time : 2021-06-24T11:19:37.000000Z
 handler_name : Core Media Metadata
 Stream #0:4(und): Data: none (mebx / 0x7862656D), 34 kb/s (default)
 Metadata:
 creation_time : 2021-06-24T11:19:37.000000Z
 handler_name : Core Media Metadata
Stream mapping:
 Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
 Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7fbe08009400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fbe08009400] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x7fbe08009400] 264 - core 163 r3060 5db6aa6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 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=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'video.mp4':
 Metadata:
 major_brand : qt
 minor_version : 0
 compatible_brands: qt
 com.apple.quicktime.creationdate: 2021-06-24T13:19:36+0200
 com.apple.quicktime.location.accuracy.horizontal: 65.000000
 com.apple.quicktime.location.ISO6709: +52.5554+013.3772+042.268/
 com.apple.quicktime.make: Apple
 com.apple.quicktime.model: iPhone 8
 com.apple.quicktime.software: 14.4.2
 encoder : Lavf58.76.100
 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1080x1920, q=2-31, 30 fps, 15360 tbn (default)
 Metadata:
 encoder : Lavc58.134.100 libx264
 creation_time : 2021-06-24T11:19:37.000000Z
 handler_name : Core Media Video
 vendor_id : [0][0][0][0]
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
 displaymatrix: rotation of -0.00 degrees
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s (default)
 Metadata:
 creation_time : 2021-06-24T11:19:37.000000Z
 handler_name : Core Media Audio
 vendor_id : [0][0][0][0]
 encoder : Lavc58.134.100 aac
frame= 295 fps= 18 q=-1.0 Lsize= 9980kB time=00:00:09.82 bitrate=8323.6kbits/s speed=0.614x
video:9884kB audio:85kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.103401%
[libx264 @ 0x7fbe08009400] frame I:6 Avg QP:21.84 size: 50301
[libx264 @ 0x7fbe08009400] frame P:217 Avg QP:24.23 size: 35435
[libx264 @ 0x7fbe08009400] frame B:72 Avg QP:24.97 size: 29582
[libx264 @ 0x7fbe08009400] consecutive B-frames: 66.8% 0.7% 4.1% 28.5%
[libx264 @ 0x7fbe08009400] mb I I16..4: 6.7% 88.9% 4.4%
[libx264 @ 0x7fbe08009400] mb P I16..4: 4.2% 32.9% 0.5% P16..4: 49.6% 5.0% 2.3% 0.0% 0.0% skip: 5.5%
[libx264 @ 0x7fbe08009400] mb B I16..4: 0.9% 6.9% 0.0% B16..8: 51.8% 7.7% 0.8% direct:12.2% skip:19.6% L0:50.1% L1:46.9% BI: 3.0%
[libx264 @ 0x7fbe08009400] 8x8 transform intra:87.7% inter:88.8%
[libx264 @ 0x7fbe08009400] coded y,uvDC,uvAC intra: 59.2% 41.2% 0.9% inter: 38.3% 57.3% 0.0%
[libx264 @ 0x7fbe08009400] i16 v,h,dc,p: 15% 23% 8% 53%
[libx264 @ 0x7fbe08009400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 14% 29% 7% 8% 7% 7% 6% 6%
[libx264 @ 0x7fbe08009400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 18% 18% 9% 11% 7% 7% 4% 3%
[libx264 @ 0x7fbe08009400] i8c dc,h,v,p: 60% 20% 18% 1%
[libx264 @ 0x7fbe08009400] Weighted P-Frames: Y:3.2% UV:2.3%
[libx264 @ 0x7fbe08009400] ref P L0: 54.2% 10.7% 22.2% 12.5% 0.4%
[libx264 @ 0x7fbe08009400] ref B L0: 75.5% 19.6% 4.9%
[libx264 @ 0x7fbe08009400] ref B L1: 88.7% 11.3%
[libx264 @ 0x7fbe08009400] kb/s:8234.01
[aac @ 0x7fbe0802e000] Qavg: 446.889



-
cant generate thumbnail using ffmpg of php
6 mars 2016, par ankur agarwali host my phpvibe website on 247host, When i upload everything works fine except two things. When i am uploading videos then thumbnail is not generating and total time of video is not generating. When i contact their customer support they send me screen shot of terminal in which root executing my command and thumbnail is generated. but when i am doing this in vibecron.php then its not working. I purchased shared hosting, I dont have access to apache log, Now i am not able to understand why my script not working on server ? and how i can test.
Here is my vibecron.php
<?php error_reporting(E_ALL);
//Vital file include
require_once("load.php");
$tp = ABSPATH.'/'.get_option('tmp-folder','rawmedia')."/";
$fp = ABSPATH.'/'.get_option('mediafolder')."/";
$ip = ABSPATH.'/'.get_option('mediafolder').'/thumbs/'; ;
//Run conversions
$crons = $db->get_results("select id,tmp_source,token from ".DB_PREFIX."videos where tmp_source != '' and source = '' limit 0,100000");
if($crons) {
foreach ($crons as $cron) {
$db->query("UPDATE ".DB_PREFIX."videos SET tmp_source='' WHERE id = '".intval($cron->id)."'");
$output ="{ffmpeg-cmd} -i {input} -vcodec libx264 -s {ffmpeg-vsize} -threads 4 -movflags faststart {output}.mp4";
//$output ="{ffmpeg-cmd} -i {input} -vcodec libx264 -s {ffmpeg-vsize} -threads 4 -strict experimental {output}.mp4";
$input = $tp.$cron->tmp_source;
$final = $fp.$cron->token;
$check = $fp.$cron->token.'.mp4';
$source= 'localfile/'.$cron->token.'.mp4';
if (file_exists($input)) {
//Start video conversion
$out = str_replace(array('{ffmpeg-cmd}','{input}','{ffmpeg-vsize}','{ffmpeg-bitrate}','{output}'),array(get_option('ffmpeg-cmd','ffmpeg'), $input, get_option('ffmpeg-vsize','640x360'), get_option('ffmpeg-bitrate','1750'),$final), $output);
shell_exec($out);
//Extract thumbnail
$imgout = "{ffmpeg-cmd} -itsoffset -4 -i {input} -y -f image2 -ss ".get_option('ffmpeg-thumb-time','00:00:03')." -vcodec mjpeg -vframes 1 -an -f rawvideo -s 500x300 {output}";
$imgfinal = $ip.$cron->token.'.jpg';
$thumb = str_replace(ABSPATH.'/' ,'',$ip.$cron->token.'.jpg');
$imgout = str_replace(array('{ffmpeg-cmd}','{input}','{output}'),array(get_option('ffmpeg-cmd','ffmpeg'), $input,$imgfinal), $imgout);
exec ( $imgout);
// Update so far
$db->query("UPDATE ".DB_PREFIX."videos SET thumb='".$thumb."', source='".$source."', pub = '".intval(get_option('videos-initial'))."' WHERE id = '".intval($cron->id)."'");
//Extract Duration
$cmd = get_option('ffmpeg-cmd','ffmpeg')." -i ".$check;
exec ( "$cmd 2>&1", $output );
$text = implode ( "\r", $output );
if (preg_match ( '!Duration: ([0-9:.]*)[, ]!', $text, $matches )) {
list ( $v_hours, $v_minutes, $v_seconds ) = explode ( ":", $matches [1] );
// duration in time format
$d = $v_hours * 3600 + $v_minutes * 60 + $v_seconds;
}
if(isset($d)) {
list ( $duration, $trash ) = explode ( ".", $d );
}
if(isset($duration)) {
$db->query("UPDATE ".DB_PREFIX."videos SET duration='".$duration."' WHERE id = '".intval($cron->id)."'");
}
add_activity('4', $cron->id);
/* End this loops item */
}
}
$db->clean_cache();
}
?> -
Issue with multiple .so files in android
8 février 2016, par ImpossibleI have developed an application in Android Studio. I have integrated FFMPEG library in my application. This library contains a module and
*.so
files. Now I need to integrate another library having a jar file and native*.so
files, Twilio for calling.
The issue I am facing is, whenever I try to build the application,*.so
file ofTwilio
library automatically gets deleted. Then app gives error that, it can not find the native file.Here is my build.gradle
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.application'
repositories {
jcenter()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "my.package.name"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
pickFirst 'META-INF/ASL2.0'
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs' //set .so files location to libs
jni.srcDirs = [] //disable automatic ndk-build call
}
// call regular ndk-build(.cmd) script from app directory
task ndkBuild(type: Exec) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'ndk-build.cmd', '-C', file('src/main').absolutePath
} else {
def ndkDir = android.ndkDirectory.getAbsolutePath()
commandLine ndkDir + '/ndk-build', '-C', file('src/main').absolutePath
}
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
}
task nativeLibsToJar(type: Jar, description: 'create a jar archive of the native libs') {
destinationDir file("$buildDir/native-libs")
baseName 'native-libs'
from fileTree(dir: 'libs', include: '**/*.so')
into 'lib/'
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn(nativeLibsToJar)
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(':ffmpegLibs')
compile files('libs/commons-codec-1.9.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:percent:23.1.1'
compile 'com.android.support:palette-v7:23.1.1'
compile 'com.fasterxml.jackson.core:jackson-core:2.7.0-rc1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.0-rc1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.0-rc1'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.code.gson:gson:2.5'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.daimajia.swipelayout:library:1.2.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.timehop.stickyheadersrecyclerview:library:0.4.3'
compile files('libs/twilioclient-android.jar')
}