
Recherche avancée
Autres articles (112)
-
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
Sur d’autres sites (15571)
-
Index error with MoviePy and OSError : MoviePy error : failed to read the duration of file
24 août 2022, par AlejandroI made a small script to concatenate some clips. The names of the clips are stored in another text file that is read from.


I get the error first that


in ffmpeg_parse_infos
line = [l for l in lines if keyword in l][index]
IndexError: list index out of range



then during that exception above, another occurs below


Traceback (most recent call last):
 File "e:\Projects\TwitchMontage\VideoCompilation\src\create_video.py", line 32, in <module>
 clips = create_clips_from_list(list)
 File "e:\Projects\TwitchMontage\VideoCompilation\src\create_video.py", line 20, in create_clips_from_list
 clip = VideoFileClip(str(video_file_path))
 File "C:\Users\Alejandro\AppData\Local\Programs\Python\Python38\lib\site-packages\moviepy\video\io\VideoFileClip.py", line 88, in __init__
 self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,
 File "C:\Users\Alejandro\AppData\Local\Programs\Python\Python38\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 35, in __init__
 infos = ffmpeg_parse_infos(filename, print_infos, check_duration,
 File "C:\Users\Alejandro\AppData\Local\Programs\Python\Python38\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 289, in ffmpeg_parse_infos
 raise IOError(("MoviePy error: failed to read the duration of file %s.\n"
OSError: MoviePy error: failed to read the duration of file E:\Projects\TwitchMontage\VideoCompilation\VideoFiles\raw_clips\clip0.mp4
</module>


I suspect something is wrong with FFMPEG but I have no idea what to change to fix this. Is there any manipulation I can make to FFMPEG or the videos themselves to make them work with moviepy ?


Code is below :


import os
from moviepy.editor import VideoFileClip, concatenate_videoclips

PATH_TO_VALID_CLIPS = 'VideoCompilation/ClipData/valid_clips.txt'
PATH_TO_RAW_CLIPS = 'E:\Projects\TwitchMontage\VideoCompilation\VideoFiles\\raw_clips'
os.environ['IMAGEIO_FFMPEG_EXE'] = 'ffmpeg'

def read_valid_clips_list():
 #read valid clips
 file = open(PATH_TO_VALID_CLIPS, 'r')
 list = file.readlines()
 return list

def create_clips_from_list(list):
 clips = []
 for i, filename in enumerate(list):
 print(str(i) + '\n')
 video_file_path = os.path.abspath(os.path.join(PATH_TO_RAW_CLIPS, filename))
 print(video_file_path + '\n')
 clip = VideoFileClip(str(video_file_path))
 clips.append(clip)

 return clips

def create_draft(clips):
 draft = concatenate_videoclips(clips)
 draft.write_videofile("VideoCompilation/VideoFiles/videos/draft.mp4")
 return draft

list = read_valid_clips_list()
clips = create_clips_from_list(list)
draft = create_draft(clips)



EDIT :


I discovered something strange. When I manually create the combined video, there are no errors but the video created is corrupted and unplayable.




-
acces to data stream (KLV) with windows media-foundation
20 février 2023, par haceneshIs there any way to acces data stream with Windows Media Foundation ?


I have a video stream that contains tree streams : Audio, video and Data stream
When I opend the file with ffmpeg I can access the three stream :


- 

- AVMEDIA_TYPE_AUDIO
- AVMEDIA_TYPE_VIDEO
- AVMEDIA_TYPE_DATA








This image show more details about the data stream I wanted to retrieve.



With windows media-foundation I can only see audio and video streams.


IMFMediaSource* pVideoSource = NULL;
IMFSourceReader* pVideoReader = NULL; 
....
....
while (pVideoReader->GetStreamSelection(stmIndex, &isSelected) == S_OK) {
 printf("Stream %d is selected %d.\n", stmIndex, isSelected);

 CHECK_HR(pVideoReader->GetCurrentMediaType(stmIndex, &pStmMediaType), "Failed to get media type for selected stream.");

 std::cout << "Media type: " << GetMediaTypeDescription(pStmMediaType) << std::endl;

 GUID majorMediaType;
 pStmMediaType->GetGUID(MF_MT_MAJOR_TYPE, &majorMediaType);
 if (majorMediaType == MFMediaType_Audio) {
 std::cout << "Source audio stream index is " << stmIndex << "." << std::endl;
 }
 else if (majorMediaType == MFMediaType_Video) {
 std::cout << "Video stream index is " << stmIndex << "." << std::endl;
 }
 stmIndex++;
 SAFE_RELEASE(pStmMediaType);
 }




**Output **




Stream 0 is selected 1.
Media type : MFMediaType_Audio : MF_MT_AUDIO_AVG_BYTES_PER_SECOND=16031, MF_MT_AUDIO_BLOCK_ALIGNMENT=1, 33026EE0-E387-4582-AE0A-34A2AD3BAA18=1, MF_MT_AUDIO_NUM_CHANNELS=2, MF_MT_MAJOR_TYPE=MFMediaType_Audio, MF_MT_AUDIO_SAMPLES_PER_SECOND=48000, MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION=254, MF_MT_AUDIO_PREFER_WAVEFORMATEX=1, MF_MT_USER_DATA=, MF_MT_FIXED_SIZE_SAMPLES=1, MF_MT_AAC_PAYLOAD_TYPE=1, MF_MT_ALL_SAMPLES_INDEPENDENT=1, MF_MT_SAMPLE_SIZE=1, MF_MT_SUBTYPE=MFAudioFormat_AAC,
Source audio stream index is 0.
Stream 1 is selected 1.
Media type : MFMediaType_Video : MF_MT_FRAME_SIZE=W:1920 H : 1080, MF_MT_MPEG_SEQUENCE_HEADER=, MF_MT_MAJOR_TYPE=MFMediaType_Video, MF_MT_AM_FORMAT_TYPE=E06D80E3-DB46-11CF-B4D1-00805F6CBBEA, MF_MT_MPEG2_LEVEL=41, MF_MT_MPEG2_PROFILE=66, MF_MT_FIXED_SIZE_SAMPLES=1, MF_MT_FRAME_RATE=25/1, MF_MT_PIXEL_ASPECT_RATIO=1:1, MF_MT_SAMPLE_SIZE=1, MF_MT_INTERLACE_MODE=2, MF_MT_SUBTYPE=3F40F4F0-5622-4FF8-B6D8-A17A584BEE5E,
Video stream index is 1.
Source media type count : 1, is first stream selected 1.
Default output media type for source reader :
MFMediaType_Video : MF_MT_FRAME_SIZE=W:1920 H : 1080, MF_MT_MPEG_SEQUENCE_HEADER=, MF_MT_MAJOR_TYPE=MFMediaType_Video, MF_MT_AM_FORMAT_TYPE=E06D80E3-DB46-11CF-B4D1-00805F6CBBEA, MF_MT_MPEG2_LEVEL=41, MF_MT_MPEG2_PROFILE=66, MF_MT_FIXED_SIZE_SAMPLES=1, MF_MT_FRAME_RATE=25/1, MF_MT_PIXEL_ASPECT_RATIO=1:1, MF_MT_SAMPLE_SIZE=1, MF_MT_INTERLACE_MODE=2, MF_MT_SUBTYPE=3F40F4F0-5622-4FF8-B6D8-A17A584BEE5E,




I also looked on the sample metadata. I didn't find anything.
MFSampleExtension_CaptureMetadata


HRESULT hr = videoSample->GetUnknown(MFSampleExtension_CaptureMetadata, IID_IMFAttributes, (void**)&pAttributes);



Result




hr = 0xc00d36e6 : The requested attribute was not found.
access to data stream with media-foundation




-
ProcessBuilder is not called when trying to start a process
15 juin 2022, par xnokI am trying to understand more about the ffmpeg usage in JavaCV for android studio and for said task I am trying to use ProcessBuilder. I tried writting a simple program to debug the
pb.start();
Although, I am not getting a response. What I did was to start a default/empty activity and pasted the following program :

package com.example.myapplication;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;

import org.bytedeco.javacpp.Loader;

import android.os.Build;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends AppCompatActivity {
 static final int cols = 192;
 static final int rows = 108;
 static final String ffmpeg = Loader.load(org.bytedeco.ffmpeg.ffmpeg.class);
 static final String rtmp_url = "test.flv";
 static final String[] command = {ffmpeg,
 "-y",
 "-f", "rawvideo",
 "-vcodec", "rawvideo",
 "-pix_fmt", "bgr24",
 "-s", (Integer.toString(cols) + "x" + Integer.toString(rows)),
 "-r", "10",
 "-i", "pipe:",
 "-c:v", "libx264",
 "-pix_fmt", "yuv420p",
 "-preset", "ultrafast",
 "-f", "flv",
 rtmp_url};
 @RequiresApi(api = Build.VERSION_CODES.O)
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 new Thread(t1).start();

 }
 private static Runnable t1 = () -> {
 Log.e("TAG", "void OnCreate called successfully!");
 ProcessBuilder pb = new ProcessBuilder(command).redirectErrorStream(true);
 pb.redirectErrorStream(true);
 try {
 Process process = pb.start();
 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
 OutputStream writer = process.getOutputStream();
 Log.e("TAG", "Something good happened here");
 } catch (IOException e) {
 e.printStackTrace();
 Log.e("TAG", "Nothing good happened here");
 }
 };


}



My current problem is that I can't seem to start properly the processBuilder process via pb.start() ;


I get the following logs from the logcat panel :


2022-06-14 17:24:46.328 13371-13371/com.example.myapplication E/TAG: void OnCreate called successfully!
2022-06-14 17:24:46.333 13371-13371/com.example.myapplication E/TAG: Nothing good happened here



I'd like to understand why is it skipping the try/catch block and not starting the process ?


EDIT : I made some changes as per @g00se's suggestions and I got the following stack trace from the code above :


2022-06-15 00:32:26.700 29787-29787/? E/USNET: USNET: appName: com.example.myapplication
2022-06-15 00:32:29.328 29787-29828/com.example.myapplication E/TAG: void OnCreate called successfully!
2022-06-15 00:32:29.330 29787-29828/com.example.myapplication E/AndroidRuntime: FATAL EXCEPTION: Thread-4
 Process: com.example.myapplication, PID: 29787
 java.lang.NullPointerException
 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1012)
 at com.example.myapplication.MainActivity.lambda$static$0(MainActivity.java:48)
 at com.example.myapplication.MainActivity$$ExternalSyntheticLambda0.run(Unknown Source:0)
 at java.lang.Thread.run(Thread.java:920)