
Recherche avancée
Médias (3)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
-
Creativecommons informational flyer
16 mai 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (44)
-
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 -
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)
Sur d’autres sites (6163)
-
ffmpeg unexpected exit code 1 for -list_devices and -list_options
8 janvier 2024, par djvgDescription


If I run any of the following commands from the examples in the documentation, using
ffmpeg
4.2.2 on Windows 10, the requested information is successfully displayed in the console, but the process exits with exit code1
, instead of the expected0
(success).

ffmpeg -list_devices true -f dshow -i dummy

ffmpeg -list_options true -f dshow -i video="MyCamera"



As far as I know, exit code
1
on Windows implies "Incorrect function", so I consider this behavior to be unexpected.

If I stream camera input to disk, using e.g.
ffmpeg -f dshow -i video="MyCamera" "myfile.mp4"
, then stop using q, the exit code is0
, as expected.

Question


Does the exit code
1
constitute normal behavior forffmpeg
, or am I doing something wrong ?

Relevance


When running the commands manually, from the command line, the exit code does not make much difference, as long as the requested information is displayed.


However, when running the commands programmatically, it may cause trouble. For example, using Python's
subprocess.run(..., check=True)
, the nonzero exit code causes a CalledProcessError.

Of course there are ways around this, e.g. use
check=False
, but the point is that a workaround would not be necessary ifffmpeg
behaved as expected, i.e. returned0
.

-
subprocess.CalledProcessError command returned non zero exit status 1 even though the command works in the CMD
11 janvier 2024, par Lucas Soreauin Python, I want the duration of a video file without the FFmpeg Python library. This is the problematic line :


output = subprocess.check_output(['ffprobe', '-i', path, '-show_entries', 'format=duration', '-v', 'quiet'], universal_newlines=True)



And it gives this error :


subprocess.CalledProcessError: Command '['ffprobe', '-i', '"C:\\FFmpeg\\Encodes\\Forza Horizon 5\\FH5 AV1.mp4"', '-show_entries', 'format=duration', '-v', 'quiet']' returned non-zero exit status 1.



But the most important, and what I don't understand, is that, in the CMD, when I input
ffprobe -i "C:\FFmpeg\Encodes\Forza Horizon 5\FH5 AV1.mp4" -show_entries format=duration -v quiet
, I'm getting :

[FORMAT]
duration=101.480000
[/FORMAT]



In the Python file, the [FORMAT] tags will be removed so that I only have the duration, so there is no error. What's wrong with it ?


By the way,
raise RuntimeError("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
doesn't return anything

I've tried removing unncessary things such as
universal_newlines=True
, and tried to search for it online, but what I found online doesn't include the fact that when I run it in the CMD, it works

-
Attempting to use recursion, why does my code only download 4 videos and exit ?
16 avril 2024, par Andrew AtwoodI am attempting to download videos from an API that I have access to. This should loop through all of the videos that were returned from the API call, save them to disc, use ffmpeg to verify the meta data from the API (this step is necessary because the API is sometimes returning incorrect information), then save attribution information and continue on if no error. However, my output from the below code is simple this :


[]
Download Done: 0
Saved 'Owner: Anthony �; Owner URL: https://www.pexels.com/@inspiredimages' to animals.txt 
13
0
Download Done: 1
Saved 'Owner: PMA; Owner URL: https://www.pexels.com/@pma-1470250' to animals.txt
35
1
Download Done: 2
Saved 'Owner: Pressmaster; Owner URL: https://www.pexels.com/@pressmaster' to animals.txt 
65
2
Download Done: 3
Saved 'Owner: Ruvim Miksanskiy; Owner URL: https://www.pexels.com/@digitech' to animals.txt 
75
3



No errors, no exit code. Just stops running. I've walked through the process in my head a few times, and I can't figure out why it only gets called 4 times. Would anyone have any insight as to where I could try troubleshooting ?


Code Here :


require("dotenv").config();
const axios = require("axios");
const concat = require("ffmpeg-concat");
const fluent = require("fluent-ffmpeg");
const fs = require("fs");

const PEXELS_API_KEY = process.env.PEXELS_API_KEY;

const SUBTOPIC = "animals";

const URLBase = `https://api.pexels.com/videos/search?query=${SUBTOPIC}&per_page=80&size=medium&orientation=landscape`;
let rVideos;
let videosToConcat = [];
let duration = 0;
let current = 0;

const fetchVideos = async () => {
 const response = await axios.get(URLBase, {
 headers: {
 Authorization: PEXELS_API_KEY,
 },
 });

 return response.data.videos;
};

const writeVideoToDisc = async (videoObj) => {
 let found = false;
 videoObj.forEach(async (file, index) => {
 if (
 found === false &&
 file.quality === "hd" &&
 file.width === 1920 &&
 file.height === 1080 &&
 file.file_type === "video/mp4"
 ) {
 found = true;
 let writer = fs.createWriteStream("raw/" + current + ".mp4");
 let streamResponse = await axios({
 url: rVideos[current].video_files[index].link,
 method: "get",
 responseType: "stream",
 });
 streamResponse.data.pipe(writer);
 writer.on("finish", () => {
 console.log(`Download Done: ${current}`);
 fluent.ffprobe(`./raw/${current}.mp4`, (err, metadata) => {
 if (err) {
 console.error(err);
 } else {
 if (
 metadata.streams[0].width !== 1920 ||
 metadata.streams[0].height !== 1080
 ) {
 fs.unlink(`./raw/${current}.mp4`, (err) => {
 if (err) throw err;
 console.log("File deleted!");
 });
 } else {
 duration += rVideos[current].duration;
 videosToConcat.push(`./raw/${current}.mp4`);
 fs.appendFile(
 `./attribution/${SUBTOPIC}.txt`,
 `Owner: ${rVideos[current].user.name}; Owner URL: ${rVideos[current].user.url} \n`,
 function (err) {
 if (err) throw err;
 console.log(
 `Saved 'Owner: ${rVideos[current].user.name}; Owner URL: ${rVideos[current].user.url}' to ${SUBTOPIC}.txt`
 );
 if (duration < 600) {
 console.log(duration);
 console.log(current);
 current++;
 writeVideoToDisc(rVideos[current].video_files);
 }
 }
 );
 }
 }
 });
 });
 writer.on("error", () => console.error("Error while dowloading video"));
 }
 });
};

const main = async () => {
 rVideos = await fetchVideos();
 console.log(rVideos.length);
 await writeVideoToDisc(rVideos[current].video_files);
 console.log(videosToConcat);
 // concat videos together
};

main();