
Recherche avancée
Médias (91)
-
Chuck D with Fine Arts Militia - No Meaning No
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Paul Westerberg - Looking Up in Heaven
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Le Tigre - Fake French
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Thievery Corporation - DC 3000
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Dan the Automator - Relaxation Spa Treatment
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Gilberto Gil - Oslodum
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (32)
-
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 ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
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
Sur d’autres sites (5100)
-
uncertain behaviour of xml parser and ffmpeg streaming
8 octobre 2013, par user2775836I am making an ios application to display live streaming from ip camera using ffmpeg libraries.I am also using http api requests and responses.the response is in xml format ,hence i am using xml parser to parse the response.I have two view controllers(first and second).I am initializing the xml parser at view did disappear function of the first view controller also i am calling the function to stop the streaming in view did disappear after xml parsing function.While navigating from first view controller to second view controller the xml parser gets initiated but the parsing response does not get completed .when i come back from second to first view controller and then navigate again to second view controller ,at that time the full response is parsed.Why the response gets parsed second time not first time and why is it parsing half first time.Please help.
The code is as follows :- (void)viewDidDisappear:(BOOL)animated {
[self parsing]; //call to parsing function
[self.h264dec stopDecode]; //call to stop streaming
self.h264dec = nil;
}
parsing function is:
-(void)parsing
{
NSString *urlString = [NSString stringWithFormat:@"http://www.example.com"];
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
[theRequest addValue: @"application/x-www-form-urlencoded; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest setHTTPMethod:@"GET"];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if( connection )
{
mutableData = [[NSMutableData alloc] init];
NSLog(@"connection successful");
}
}
-(void) connection:(NSURLConnection *) connection didReceiveResponse:(NSURLResponse *)response
{
NSLog(@"receive response");
}
-(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[mutableData appendData:data];
NSLog(@"DIDRECEIVE");
NSLog(@"the mutable data is: %@",mutableData);
}
-(void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
return;
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(@"finish loading");
// You can do your functions here. If your repines is in XML you have to parse the response using NSXMLParser. If your response in JSON you have use SBJSON.
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:mutableData];
[parser setDelegate:self];
[parser parse];
}
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
{
if([elementName isEqualToString:@"Response"]){
NSLog(@"item found");
xmlStringFileObject =[[XMLStringFile alloc]init];
}
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
[nodecontent appendString:[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
NSLog(@"node content = %@",nodecontent);
}
//bellow delegate method specify when it encounter end tag of specific that tag
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
//I am saving my nodecontent data inside the property of XMLString File class
if([elementName isEqualToString:@"test"]){
xmlStringFileObject.test=nodecontent;
NSLog(@"test:%@",xmlStringFileObject.test);
}
else if([elementName isEqualToString:@"resolution"]){
xmlStringFileObject.resolution=nodecontent;
NSLog(@"resolution:%@",xmlStringFileObject.resolution);
AppDelegate *app = (AppDelegate*) [[UIApplication sharedApplication]delegate];
app.res = xmlStringFileObject.resolution;
NSLog(@"THE APPDELEGATE RES VALUE IS:%@",app.res);
}
//finally when we reaches the end of tag i am adding data inside the NSMutableArray
if([elementName isEqualToString:@"Response"]){
[rssOutputData addObject:xmlStringFileObject];
xmlStringFileObject = nil;
}
//release the data from mutable string variable
//reallocate the memory to get new content data from file
nodecontent=[[NSMutableString alloc]init];
} -
How to play ffmpeg dash ?
30 janvier 2024, par Roshan OjhaI have following code to create chunk of video.


permission_classes=[AllowAny]
video_serializer = serializers.video_serializer

def process_video(self, video_path, video_id):
 # Set the path where the processed videos will be saved
 output_dir = os.path.join(settings.MEDIA_ROOT, 'processed_videos')

 # Create the output directory if it doesn't exist
 os.makedirs(output_dir, exist_ok=True)

 # Add your ffmpeg_streaming code here to process the video
 full_video_path = os.path.join(settings.MEDIA_ROOT, str(video_path))
 print(video_path)
 video = ffmpeg_streaming.input(full_video_path)
 print(video)

 # Add your ffmpeg_streaming code here to process the video
 _144p = Representation(Size(256, 144), Bitrate(95 * 1024, 64 * 1024))
 _240p = Representation(Size(426, 240), Bitrate(150 * 1024, 94 * 1024))
 _360p = Representation(Size(640, 360), Bitrate(276 * 1024, 128 * 1024))
 _480p = Representation(Size(854, 480), Bitrate(750 * 1024, 192 * 1024))
 _720p = Representation(Size(1280, 720), Bitrate(2048 * 1024, 320 * 1024))

 dash = video.dash(Formats.h264())
 dash.representations(_144p, _240p, _360p, _480p, _720p)
 dash.output(os.path.join(output_dir, f'dash-stream-{video_id}.mpd'))


def post(self,request):
 try:
 video_data = self.video_serializer(data=request.data)
 video_data.is_valid(raise_exception=True)
 data = video_data.validated_data

 video_instance = Video.objects.create(
 id = data.get('id'),
 saved_location = data.get('video')
 )
 video_instance.save()

 self.process_video(video_instance.saved_location, video_instance.id)
 return Response({"success":True})
 except Exception as e:
 return Response({"success":False,"message":str(e)})



This code is working well as it has created different chunk files as well as a
.mpd
file of a video insidemedia/processed_video
folder.

Then I wrote following code to stream that video using that
.mpd
folder.

def get (self,request,video_id):
 try:
 mpd_path = os.path.join(settings.MEDIA_ROOT, 'processed_videos', f'dash-stream-{video_id}.mpd')
 
 with open(mpd_path, 'rb') as f:
 mpd_content = f.read()
 response = HttpResponse(mpd_content, content_type='application/dash+xml')

 # Set Content-Disposition header to make the response downloadable
 response['Content-Disposition'] = f'attachment; filename="dash-stream-{video_id}.mpd"'
 
 # Optionally set Content-Length header to specify the size of the file
 response['Content-Length'] = len(mpd_content)
 
 return response
 
 except Exception as e:
 return Response({"success":False,"message":str(e)})



When I make get request to the api it returns content of
.mpd
as it is (i.e xml). When I used that api invlc network stream
, vlc couldn't play the video. But when I dragged.mpd
file directly to vlc, the video gets played with 144p only. I don't know where I got wrong inGET
. Please help.

-
Failed to convert web-saved .wemb audio to .wav by using php "shell_exec" and javascript
30 mai 2022, par AnirbasgnawI'm working on an online experimenter which could record participants' audio from the browser. The audio data I get has an extension of .wemb, so I plan to use ffmpeg to convert it to .wav while I save the data.


I tried to use PHP's
shell_exec
but nothing happens when I run the scripts. Then I found that myecho
andprint_r
also did not work. I'm new to PHP and javascript, so I''m really confused now.

Below are the relevant codes, I really appreciate it if you could help !


write_data.php
:

<?php
 $post_data = json_decode(file_get_contents('php://input'), true); 
 // the directory "data" must be writable by the server
 $name = "../".$post_data['filename'];
 $data = $post_data['filedata'];
 // write the file to disk
 file_put_contents($name, $data);
 
 $INPUT = trim($name) . ".webm";
 $OUTPUT = trim($name) . ".wav";
 echo "start converting...";

 // check if ffmprg is available
 $ffmpeg = trim(shell_exec('which ffmpeg'));
 print_r($ffmpeg);
 // call ffmpeg
 shell_exec("ffmpeg -i '$INPUT' -ac 1 -f wav '$OUTPUT' 2>&1 ");
?>



javascript
:

saveData: function(fileName,format){
 // save as json by default
 if (!format){ format = 'json';}
 // add extension to filename
 fileName = `${fileName}.${format}`
 // create saveData object using fetch
 let saveData = [];
 if (format == 'json') {
 saveData = {
 type: 'call-function',
 async: true,
 func: async function(done) {
 let data = jsPsych.data.get().json();
 const response = await fetch("../write_data.php", {
 method: "POST",
 headers: {
 "content-type": "application/json"
 },
 body: JSON.stringify({ filename: fileName, filedata: data })
 });
 if (response.ok) {
 const responseBody = await response.text();
 done(responseBody);
 }
 }
 }
 } else {
 saveData = {
 type: 'call-function',
 async: true,
 func: async function(done) {
 let data = jsPsych.data.get().csv();
 const response = await fetch("../write_data.php", {
 method: "POST",
 headers: {
 "content-type": "application/json"
 },
 body: JSON.stringify({ filename: fileName, filedata: data })
 });
 if (response.ok) {
 const responseBody = await response.text();
 done(responseBody);
 }
 }
 }
 }
 return saveData;
 },