
Recherche avancée
Médias (1)
-
SPIP - plugins - embed code - Exemple
2 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
Autres articles (86)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
MediaSPIP Player : problèmes potentiels
22 février 2011, parLe lecteur ne fonctionne pas sur Internet Explorer
Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)
Sur d’autres sites (10134)
-
Format video to upload on instagram API (Nodejs)
6 octobre 2022, par Rafael de CarvalhoI'm trying to automate the process of posting photos and videos on instagram but I constantly get errors when uploading to instagram.


I will leave a video duration error here but several others happen, I need to follow the following requirements :


- 

- Container : MOV or MP4 (MPEG-4 Part 14), no edit lists, atom moov in front of file
- Audio codec : AAC, 48 kHz maximum sampling rate, 1 or 2 channel (mono or stereo)
- Video codec : HEVC or H.264, progressive scan, closed GOP, 4:2:0 chroma subsampling
- Frame rate : from 23 to 60 FPS
- photo size :

- 

- Maximum columns (horizontal pixels) : 1,920
- Minimum aspect ratio [columns/rows] : 4/5
- Maximum aspect ratio [columns/rows] : 9/16








- Video bitrate : 5Mbps maximum VBR
- Audio bitrate : 128 kbps
- Duration : maximum 60 seconds and minimum 3 seconds
- File size : max 100 MB




















My code :


import { S3 } from 'aws-sdk';
import { IgApiClient } from 'instagram-private-api';
import fs from 'fs';

const s3 = new S3();
const ig = new IgApiClient();
const bucket = 'posts';
const { INSTA_USER, INSTA_PASS } = process.env;

ig.state.generateDevice(INSTA_USER);

export const main = async () => {
 try {
 await ig.account.login(INSTA_USER, INSTA_PASS);

 const { Contents } = await s3.listObjectsV2({ Bucket: bucket, MaxKeys: 2, Prefix: 'memes/geral' }).promise();

 const files = await Promise.all(Contents.map(async ({ Key }) => {
 const file = await s3.getObject({
 Bucket: bucket,
 Key,
 }).promise();

 return file.Body;
 }));

 const publishResult = await ig.publish.video({
 video: files[0],
 coverImage: await fs.readFileAsync("../../src/assets/cover.png")
 });

 console.dir({ publishResult }, { depth: null })
 } catch (error) {
 console.error(error);
 throw error;
 }
}



When I get a file from s3, it comes in the following format.
I'm taking the content of the body property and put it in the video property of the publish method.
Is it right ?
I also tried to save the file with fs.writeFile and dps use readFileSync like in the example but it also gave the same error.


{
 AcceptRanges: 'bytes',
 LastModified: 2022-08-04T23:15:24.000Z,
 ContentLength: 3252472,
 ETag: '"c491cfe2fb5bc29777fc34391fc1d56a"',
 ContentType: 'application/octet-stream',
 Body: Buffer(3252472) [Uint8Array] [
 0, 0, 0, 32, 102, 116, 121, 112, 105, 115, 111, 109,
 0, 0, 2, 0, 105, 115, 111, 109, 105, 115, 111, 50,
 97, 118, 99, 49, 109, 112, 52, 49, 0, 0, 209, 0,
 109, 111, 111, 118, 0, 0, 0, 108, 109, 118, 104, 100,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 3, 232, 0, 0, 250, 17, 0, 1, 0, 0,
 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0,
 ... 3252372 more items
 ]
 }



Error :


{
 "errorMessage": "POST /api/v1/media/upload_finish/?video=1 - 400 Bad Request; server processing error: VideoSourceDurationCheckException",
 "errorType": "IgUploadVideoError",
 "stackTrace": [
 "IgUploadVideoError: POST /api/v1/media/upload_finish/?video=1 - 400 Bad Request; server processing error: VideoSourceDurationCheckException",
 " at C:\\Users\\User\\Desktop\\dev\\Insta\\.webpack\\service\\src\\functions\\webpack:\\instagram-private-api\\dist\\services\\publish.service.js:26:1", 
 " at tryCatcher (C:\\Users\\User\\Desktop\\dev\\Insta\\.webpack\\service\\src\\functions\\webpack:\\bluebird\\js\\release\\util.js:16:1)"
}



when I try to post a video under 60 seconds (apparently within the requirements) :


{
 "errorMessage": "POST /api/v1/media/configure/?video=1 - 403 Forbidden; ",
 "errorType": "IgConfigureVideoError",
 "stackTrace": [
 "IgConfigureVideoError: POST /api/v1/media/configure/?video=1 - 403 Forbidden; ",
 " at PublishService.video (C:\\Users\\User\\Desktop\\dev\\Insta\\.webpack\\service\\src\\functions\\webpack:\\instagram-private-api\\dist\\services\\publish.service.js:123:1)", 
 " at C:\\Users\\User\\Desktop\\dev\\Insta\\.webpack\\service\\src\\functions\\webpack:\\src\\functions\\cronFreefireMemes.js:71:31",
 " at async Promise.all (index 1)",
 " at main (C:\\Users\\User\\Desktop\\dev\\Insta\\.webpack\\service\\src\\functions\\webpack:\\src\\functions\\cronFreefireMemes.js:47:5)"
 ]
}



I know that the error above is happening because of the size of the video which is longer than 60 seconds.


But I would like to know if there is any way I can format any video to fit the instagram requirements.


Any nodejs library ?


-
Anomalie #3882 : Ancres des notes de bas de page pour les URL arborescente
11 mai 2021, par cedric -Ça marche chez moi (tm) en prod depuis des années, avec un squelette Z (donc le head et les #NOTES ne sont pas du tout dans un même fichier), donc non, c’est un peu plus compliqué que ça
La fonctionpage_base_href()
est appelée dans https://git.spip.net/spip/spip/src/branch/master/ecrire/public/evaluer_page.php#L96 donc pour chaque inclusion, et aussi avant l’affichage final https://git.spip.net/spip/spip/src/branch/master/ecrire/public.php#L157Mais de fait, en relisant le code il semble qu’on puisse être mis en echec si le base est inséré trop tot, car ensuite ça ne fonctionne plus
Peux tu essayer ce patch ?$ git diff ecrire/public/assembler.php diff —git a/ecrire/public/assembler.php b/ecrire/public/assembler.php index a7dcd82044..224999f281 100644
— - a/ecrire/public/assembler.php +++ b/ecrire/public/assembler.php @@ -722,30 +722,36 @@ function page_base_href(&$texte) ) $head = substr($texte, 0, $poshead) ; $insert = false ; + $href_base = false ; if (strpos($head, ’<base’) === false) $insert = true ; else// si aucun <base ...> n’a de href c’est bon quand meme ! + // si aucun <base ...> n’a de href il faut en inserer un + // sinon juste re-ecrire les ancres si besoin $insert = true ; include_spip(’inc/filtres’) ; $bases = extraire_balises($head, ’base’) ; foreach ($bases as $base)
if (extraire_attribut($base, ’href’)) + if ($href_base = extraire_attribut($base, ’href’)) $insert = false ; + break ;
if ($insert) + + if ($insert) include_spip(’inc/filtres_mini’) ; // ajouter un base qui reglera tous les liens relatifs
$base = url_absolue(’./’) ;
$bbase = "\n<base href=\"$base\" />" ;
if (($pos = strpos($head, ’’)) !== false)
$head = substr_replace($head, $bbase, $pos + 6, 0) ; + $href_base = url_absolue(’./’) ; + $base = "\n<base href=\"$href_base\" />" ; + if (($pos = strpos($head, ’’)) !==false) + $head = substr_replace($head, $base, $pos+6, 0) ; elseif (preg_match(",]*>,i", $head, $r))
$head = str_replace($r[0], $r[0] . $bbase, $head) ; + $head = str_replace($r[0], $r[0] . $base, $head) ; $texte = $head . substr($texte, $poshead) ; + + if ($href_base) // gerer les ancres $base = $_SERVER[’REQUEST_URI’] ; // pas de guillemets ni < dans l’URL qu’on insere dans le HTML
ou si tu préfères le code intégral de la fonction corrigée :
// https://code.spip.net/@page_base_href function page_base_href(&$texte) static $set_html_base = null ; if (is_null($set_html_base)) if (!defined(’_SET_HTML_BASE’)) // si la profondeur est superieure a 1 // est que ce n’est pas une url page ni une url action // activer par defaut $set_html_base = (( $GLOBALS[’profondeur_url’] >= (_DIR_RESTREINT ? 1 : 2) and _request(_SPIP_PAGE) !== ’login’ and !_request(’action’)) ? true : false) ; else $set_html_base = _SET_HTML_BASE ;
if ($set_html_base
and isset($GLOBALS[’html’]) and $GLOBALS[’html’]
and $GLOBALS[’profondeur_url’] > 0
and ($poshead = strpos($texte, ’’)) !== false
)
$head = substr($texte, 0, $poshead) ;
$insert = false ;
$href_base = false ;
if (strpos($head, ’<base’) === false)
$insert = true ;
else
// si aucun <base ...> n’a de href il faut en inserer un
// sinon juste re-ecrire les ancres si besoin
$insert = true ;
include_spip(’inc/filtres’) ;
$bases = extraire_balises($head, ’base’) ;
foreach ($bases as $base)
if ($href_base = extraire_attribut($base, ’href’))
$insert = false ;
break ;
if ($insert)
include_spip(’inc/filtres_mini’) ;
// ajouter un base qui reglera tous les liens relatifs
$href_base = url_absolue(’./’) ;
$base = "\n<base href=\"$href_base\" />" ;
if (($pos = strpos($head, ’’)) !==false)
$head = substr_replace($head, $base, $pos+6, 0) ;
elseif (preg_match(",]*>,i", $head, $r))
$head = str_replace($r[0], $r[0] . $base, $head) ;
$texte = $head . substr($texte, $poshead) ;
if ($href_base)
// gerer les ancres
$base = $_SERVER[’REQUEST_URI’] ;
// pas de guillemets ni < dans l’URL qu’on insere dans le HTML
if (strpos($base,"’") or strpos($base,’"’) or strpos($base,’<’))
$base = str_replace(array("’",’"’,’<’),array("%27",’%22’,’%3C’), $base) ;
if (strpos($texte, "href=’#") !== false)
$texte = str_replace("href=’#", "href=’$base#", $texte) ;
if (strpos($texte, "href=\"#") !== false)
$texte = str_replace("href=\"#", "href=\"$base#", $texte) ;
-
FFMPEG, macOS Catalina : "ffmpeg stderr : /private/tmp/com.apple.launchd.ID/org.macosforge.xquartz:0 : Operation not supported on socket"
11 février 2021, par Bogdan SlyusarenkoI'm trying to record selenium test run with FFMPEG, for automation testing of web extensions (selenium+js/ts).
FFMPEG initiated by command :


const { spawn } = require("child_process");
 ffmpeg = spawn("ffmpeg", [
 "-x265-params",
 "-f",
 "xcbgrab", 
 "-video_size",
 "1280x1024", 
 "-i",
 process.env.DISPLAY, // "/private/tmp/com.apple.launchd.ID/org.macosforge.xquartz:0"
 "-loglevel",
 "debug", 
 "-y", 
 "-pix_fmt",
 "yuv420p",
 videoPath, 
 ]);



Return constantly error,related to process.DISPLAY, I'm not sure why it's so :


ffmpeg stderr: /private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0: Operation not supported on socket



Full debug login is :


ffmpeg stderr: ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
ffmpeg stderr: built with Apple clang version 12.0.0 (clang-1200.0.32.28)
ffmpeg stderr: configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_9 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --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-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
ffmpeg stderr: libavutil 56. 51.100 / 56. 51.100
ffmpeg stderr: libavcodec 58. 91.100 / 58. 91.100
ffmpeg stderr: libavformat 58. 45.100 / 58. 45.100
ffmpeg stderr: libavdevice 58. 10.100 / 58. 10.100
ffmpeg stderr: libavfilter 7. 85.100 / 7. 85.100
ffmpeg stderr: libavresample 4. 0. 0 / 4. 0. 0
ffmpeg stderr: libswscale 5. 7.100 / 5. 7.100
ffmpeg stderr: libswresample 3. 7.100 / 3. 7.100
ffmpeg stderr: libpostproc 55. 7.100 / 55. 7.100
ffmpeg stderr: Splitting the commandline.
ffmpeg stderr: Reading option '-x265-params' ...
ffmpeg stderr: matched as AVOption 'x265-params' with argument '-f'.
ffmpeg stderr: Reading option 'xcbgrab' ...
ffmpeg stderr: matched as output url.
ffmpeg stderr: Reading option '-video_size' ...
ffmpeg stderr: matched as AVOption 'video_size' with argument '1280x1024'.
ffmpeg stderr: Reading option '-i' ... matched as input url with argument '/private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0'.
ffmpeg stderr: Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
ffmpeg stderr: Reading option '-y' ...
ffmpeg stderr: matched as option 'y' (overwrite output files) with argument '1'.
ffmpeg stderr: Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
ffmpeg stderr: Reading option '/Volumes/MacHD2/Upprojects/TEST/log/Checkout-Google.com-Search-on-Google.mp4' ... matched as output url.
ffmpeg stderr: Finished splitting the commandline.
ffmpeg stderr: Parsing a group of options: global .
ffmpeg stderr: Applying option loglevel (set logging level) with argument debug.
ffmpeg stderr: Applying option y (overwrite output files) with argument 1.
ffmpeg stderr: Successfully parsed a group of options.
ffmpeg stderr: Parsing a group of options: input url /private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0.
ffmpeg stderr: Successfully parsed a group of options.
ffmpeg stderr: Opening an input file: /private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0.
ffmpeg stderr: [NULL @ 0x7fcf80016800] Opening '/private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0' for reading
ffmpeg stderr: [file @ 0x7fcf7f507a00] Setting default whitelist 'file,crypto,data'
ffmpeg stderr: /private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0: Operation not supported on socket




Any feedback appreciated