
Recherche avancée
Autres articles (68)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
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 (...)
Sur d’autres sites (7252)
-
Trying to fetch all audio streams with FFmpeg Python
27 juillet 2022, par ApolloI'm using ffmpeg-python to fetch streams from a video and write some parameters (codec_name, resolution, etc.) for each stream into csv.


video = 'test.mkv'
probe = ffmpeg.probe(video)
video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
print(video_stream['codec_long_name'])
audio_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'audio'), None)
...



My problem is that it works well for a video stream, but not for multiple audio (or subtitles) streams. If the video has several audio streams it returns only one audio stream.


I've tried another approach, but it returns some streams 2-3 times and I get duplicates. So if the video sample has 4 audio tracks, I end up with 9 audio streams instread of 4.


audio_streams = []
for audio in (probe['streams']):
 if (audio['codec_type'] == 'audio'):
 audio_streams.append(audio)
 pprint(audio_streams)



All other ideas I tried don't work, I'm new to programming and I'm stuck with it.
How can I get all audio streams from a file without duplicates ?


-
How do I get the last line of a popen() callback in every iteration ?
29 mai 2017, par MikeI’m trying to create a progress bar with FFMPEG using php and AJAX. When a user uploads a video file I want to be able to display the current percent until completion. I have managed to get everything working but I have one issue.
The data returns what I want, but it also returns all the data from the previous iterations... like it just keeps stacking everything on top rather than flushing out the data from previous iterations. I tried to work with
tail
thinking it would return only the last line, but it did not return anything.Here is the code I’m working with :
encode.php
$video_path = 'test.mp4';
$cmd = 'ffmpeg -i ' . $video_path .' -y -hide_banner output.mp4 2>&1';
while (@ ob_end_flush());
$proc = popen($cmd, 'r');
while (!feof($proc))
{
$file = escapeshellarg(fread($proc, 4096));
//$line = `tail -n 1 $file`; // <-tried this with no luck
echo fread($file, 4096) . "\n";
@ flush();
}
return 'complete';
pclose($proc);The above code returns :
// first iteration
frame= 52 fps= 13 q=29.0 size= 279kB time=00:00:00.10 bitrate=22856.9kbits/s
// second iteration
frame= 52 fps= 13 q=29.0 size= 279kB time=00:00:00.10 bitrate=22856.9kbits/s
frame= 54 fps= 12 q=29.0 size= 329kB time=00:00:00.16 bitrate=16146.6kbits/s
// third iteration
frame= 52 fps= 13 q=29.0 size= 279kB time=00:00:00.10 bitrate=22856.9kbits/s
frame= 54 fps= 12 q=29.0 size= 329kB time=00:00:00.16 bitrate=16146.6kbits/s
frame= 57 fps= 11 q=29.0 size= 464kB time=00:00:00.26 bitrate=14233.2kbits/sAs you can see the data stacks, I need only the new line of data, not the data stacking.
** EDIT ** this has been marked as a duplicate, rather than me explain how it’s different, I’d like to hear how this is the same thing ? I am not writing to a log file and, like most people, do not feel that’s a good solution.
-
Check incomplete video segment with ffmpeg
31 janvier 2021, par carl.hiassI have a user who has a very large video that they have to upload : it is at least 100GB and of the
.mov
format. I need to check the following before the user is able to upload the full file :

- 

- Has resolution 1920x080
- Has video codec Apple ProRes 422
- Has either 6 or 8 audio tracks
- Has PCM Little Endian audio










I have thought of the following approaches in order to check if the user has a valid file for uploading :


- 

- Perhaps grab only the first 10K bytes of the file and check the header (would this always work ?)
- Grab perhaps 10K of the head and 10K of the tail and run ffmpeg of that (either server-side or on in-browser via https://itnext.io/build-ffmpeg-webassembly-version-ffmpeg-js-part-1-preparation-ed12bf4c8fac).






What might be a good approach to do this ? Again, to repeat, I have a user uploading a very large video and I want to pre-check that it meets four criteria before allowing them to upload the entire video file.