
Recherche avancée
Autres articles (78)
-
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 -
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
Diogene : création de masques spécifiques de formulaires d’édition de contenus
26 octobre 2010, parDiogene est un des plugins ? SPIP activé par défaut (extension) lors de l’initialisation de MediaSPIP.
A quoi sert ce plugin
Création de masques de formulaires
Le plugin Diogène permet de créer des masques de formulaires spécifiques par secteur sur les trois objets spécifiques SPIP que sont : les articles ; les rubriques ; les sites
Il permet ainsi de définir en fonction d’un secteur particulier, un masque de formulaire par objet, ajoutant ou enlevant ainsi des champs afin de rendre le formulaire (...)
Sur d’autres sites (7668)
-
React Native Expo File System : open failed : ENOENT (No such file or directory)
9 février 2023, par coloradayI'm getting this error in a bare React Native project :


Possible Unhandled Promise Rejection (id: 123):
Error: /data/user/0/com.filsufius.VisionishAItest/files/image-new-♥d.jpg: open failed: ENOENT (No such file or directory)



The same code was saving to File System with no problem yesterday, but today as you can see I am getting an ENOENT error, plus I am getting these funny heart shapes ♥d in the path. Any pointers as to what might be causing this, please ? I use npx expo run:android to builld app locally and expo start —dev-client to run on a physical Android device connected through USB.


import { Image, View, Text, StyleSheet } from "react-native";
import * as FileSystem from "expo-file-system";
import RNFFmpeg from "react-native-ffmpeg";
import * as tf from "@tensorflow/tfjs";
import * as cocossd from "@tensorflow-models/coco-ssd";
import { decodeJpeg, bundleResourceIO } from "@tensorflow/tfjs-react-native";

const Record = () => {
 const [frames, setFrames] = useState([]);
 const [currentFrame, setCurrentFrame] = useState(0);
 const [model, setModel] = useState(null);
 const [detections, setDetections] = useState([]);

 useEffect(() => {
 const fileName = "image-new-%03d.jpg";
 const outputPath = FileSystem.documentDirectory + fileName;
 RNFFmpeg.execute(
 "-y -i https://res.cloudinary.com/dannykeane/video/upload/sp_full_hd/q_80:qmax_90,ac_none/v1/dk-memoji-dark.m3u8 -vf fps=25 -f mjpeg " +
 outputPath
 )
 .then((result) => {
 console.log("Extraction succeeded:", result);
 FileSystem.readDirectoryAsync(FileSystem.documentDirectory).then(
 (files) => {
 setFrames(
 files
 .filter((file) => file.endsWith(".jpg"))
 .sort((a, b) => {
 const aNum = parseInt(a.split("-")[2].split(".")[0]);
 const bNum = parseInt(b.split("-")[2].split(".")[0]);
 return aNum - bNum;
 })
 );
 }
 );
 })
 .catch((error) => {
 console.error("Extraction failed:", error);
 });
 }, []);

 useEffect(() => {
 tf.ready().then(() => cocossd.load().then((model) => setModel(model)));
 }, []);
 useEffect(() => {
 if (frames.length && model) {
 const intervalId = setInterval(async () => {
 setCurrentFrame((currentFrame) =>
 currentFrame === frames.length - 1 ? 0 : currentFrame + 1
 );
 const path = FileSystem.documentDirectory + frames[currentFrame];
 const imageAssetPath = await FileSystem.readAsStringAsync(path, {
 encoding: FileSystem.EncodingType.Base64,
 });
 const imgBuffer = tf.util.encodeString(imageAssetPath, "base64").buffer;
 const imageData = new Uint8Array(imgBuffer);
 const imageTensor = decodeJpeg(imageData, 3);
 console.log("after decodeJpeg.");
 const detections = await model.detect(imageTensor);
 console.log(detections);
 setDetections(detections);
 }, 100);
 return () => clearInterval(intervalId);
 }
 }, [frames, model]);

 
 return (
 <view style="{styles.container}">
 
 <view style="{styles.predictions}">
 {detections.map((p, i) => (
 <text key="{i}" style="{styles.text}">
 {p.class}: {(p.score * 100).toFixed(2)}%
 </text>
 ))}
 </view>
 </view>
 );
};

const styles = StyleSheet.create({
 container: {
 flex: 1,
 alignItems: "center",
 justifyContent: "center",
 },
 image: {
 width: 300,
 height: 300,
 resizeMode: "contain",
 },
 predictions: {
 width: 300,
 height: 100,
 marginTop: 20,
 },
 text: {
 fontSize: 14,
 textAlign: "center",
 },
});

export default Record;```



-
HTML5 transparent video with the greatest cross-browser/system support
22 juin 2022, par Will AshworthI'm encountering an issue getting videos with alpha transparency to reliably load and play on a web page. After some thorough research, this is where I ended up as a means of video encoding to accomplish transparent video which isn't over a solid background color.


Hoping the general community has insight into why we're noticing weirdness with MacOS Monterey in Safari 15 🤷♂️


Note : We tried Lottie as an option for the animations, but what we found was that the DOM was excessively bloated ; which would inevitably cause performance issues for the website. So we went back to video as an option.


Convert to HEVC with alpha


ffmpeg -i "source.mov" -c:v hevc_videotoolbox -allow_sw 1 -alpha_quality 1 -vtag hvc1 output.mov



Convert to VP9 with alpha


ffmpeg -i "source.mov" -c:v libvpx-vp9 output.webm



HTML5 method of serving these files to the browser


<video autoplay="autoplay" loop="loop" muted="muted" playsinline="playsinline" class="tmpl-front-page__transition-item tmpl-front-page__transition-item--0 tmpl-front-page__transition-item--banner-video">
 <source src="path/to/video.mov" type="'video/mp4;" codecs="hvc1">
 <source src="path/to/video.webm" type="video/webm">
</source></source></video>



How it works


Essentially, we've learned the following :


- 

- Safari supports HEVC with alpha, Chrome does not
- Chrome supports VP9 with alpha, Safari does not






Now we let the browser choose which version it wants to use.


There are issues


There's inconsistency in how reliably this works in reality. For example, I'm currently running MacOS Catalina with Safari 14.0.2, and the videos started loading for me when using the above method.


While testing MacOS Monterey with Safari 15.1 inside a Parallels VM, the video doesn't load at all when I test that way. That said, another developer on our team did take the plunge and upgraded to Monterey and has Safari 15.1 ; and he can see the videos loading just fine.


This is getting a little silly, and I'm not sure what else to try. Thanks for any help !


-
Image generated by System.Drawing.Image is 10x larger than original file
13 mai 2021, par NinburaI've written a Powershell script that extracts one frame from a dshow capture device using FFmpeg, and then copies the output image from a file to my clipboard :


$screenshot = [System.Drawing.Image]::FromFile((Get-Item -Path $outputFilePath))
[System.Windows.Forms.Clipboard]::SetImage($screenshot)
$screenshot.Dispose()



The original file is a 1MB JPEG, but the image in my clipboard is an 11MB PNG. When I go to paste this file into something like Discord the file size is too large, unless you have Discord Nitro.


Is there any way to avoid this file size inflation while using
[System.Drawing.Image]::FromFile()
?

Here's an easy test template :


Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms

$screenshot = [System.Drawing.Image]::FromFile((Get-Item -Path "Path to picture"))
[System.Windows.Forms.Clipboard]::SetImage($screenshot)
$screenshot.Dispose()



Edit 2021/05/13 :


Interestingly, it's starting to seem like this is a limitation of copying an image to a clipboard. I decided to dig deeper and see if the image size was increasing when I drew the image with
System.Drawing.Image
or when I pushed it in my clipboard withSystem.Windwos.Forms.Clipboard
. If I save the image before putting it my clipboard like so, it retains the original file size, even if I change the extension to png :

Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms

$screenshot = [System.Drawing.Image]::FromFile((Get-Item -Path "C:\Users\gabri\Pictures\FFScreenshots\2021-05-12 19-04-26.845.jpeg"))
$screenshot.Save("C:\Users\gabri\Pictures\FFScreenshots\test.jpeg") # test.png makes no difference
$screenshot.Dispose()



So it would seem that the image grows exponentially in size specifically when I push it to my clipboard. I verified this by simply uploading an image to Discord, copying it to my clipboard (click image > Open original > right click and copy result), and uploading it again. Sure enough, the new image pasted from my clipboard was around 10x the size of the original image (1MB vs 12MB). I wondered if this was a "limitation" of Windows so I ran the same test on Ubuntu 20.04. Uploaded an image to Discord, copied the image to my clipboard, and uploaded it again. Once again the image was about 10x larger, though slightly smaller than then when I uploaded the image from my clipboard on my Windows machine (11.4MB VS 12MB). Just to make sure this wasn't limited to Discord, I ran the same test with Gmail in-browser on both operating systems, same result.


Alas, there appears to be something happening when you copy an image to a clipboard that drastically increases file size. One thing's for sure, whatever's happening is definitely over my head.