
Recherche avancée
Autres articles (63)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
(Dés)Activation de fonctionnalités (plugins)
18 février 2011, parPour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...) -
Activation de l’inscription des visiteurs
12 avril 2011, parIl est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)
Sur d’autres sites (11102)
-
FFmpeg - get and play audio data from frames
22 avril 2019, par AscendCodeI have an project that use FFmpeg to play video. I was able to step frames from the video and display image gotten from those. But don’t know how to get audio data from those frames and play it.
Did any one experience with FFmpeg and audio processing ?
Please help.
Thanks in advance// Here is a piece of the code written in Objective C
FFDecoder.m
-(id)initWithVideo:(NSString *)moviePath{
self = [super init];
if (self == nil) {
return nil;
}
pFormatCtx = avformat_alloc_context();
AVCodec * pCodec = NULL;
if(avformat_open_input(&pFormatCtx, [moviePath cStringUsingEncoding:NSUTF8StringEncoding], NULL, NULL) != 0){
av_log(NULL, AV_LOG_ERROR, "Couldn't open file\n");
goto initError;
}
if (avformat_find_stream_info(pFormatCtx, NULL) < 0) {
avformat_close_input(&pFormatCtx);
av_log(NULL, AV_LOG_ERROR, "Couldn't find stream information\n");
goto initError;
}
av_dump_format(pFormatCtx, 0, [moviePath.lastPathComponent cStringUsingEncoding:NSUTF8StringEncoding], false);
videoStream = -1;
for (int i = 0 ; i < pFormatCtx->nb_streams; ++i ) {
if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO && videoStream < 0) {
videoStream = i;
}
}
if (videoStream == -1) {
av_log(NULL, AV_LOG_ERROR, "Didn't find a video stream");
goto initError;
}
pCodecCtx = pFormatCtx->streams[videoStream]->codec;
pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
if (!pCodec) {
av_log(NULL, AV_LOG_ERROR, "unsupported codec\n");
goto initError;
}
if (avcodec_open2(pCodecCtx, pCodec, NULL) < 0) {
av_log(NULL, AV_LOG_ERROR, "Can't open video decoder\n");
goto initError;
}
pFrame = av_frame_alloc();
outputWidth = pCodecCtx->width;
outputHeight = pCodecCtx->height;
return self;
initError:
return nil;
}
- (void)seekTime:(double)seconds {
AVRational timeBase = pFormatCtx->streams[videoStream]->time_base;
int64_t targetFrame = (int64_t)((double)timeBase.den / timeBase.num * seconds);
avformat_seek_file(pFormatCtx, videoStream, targetFrame, targetFrame, targetFrame, AVSEEK_FLAG_FRAME);
avcodec_flush_buffers(pCodecCtx);
}
- (BOOL)stepFrame {
int frameFinished = 0;
while (!frameFinished && av_read_frame(pFormatCtx, &pPacket) >= 0) {
if (pPacket.stream_index == videoStream) {
//decode video frame
avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &pPacket);
}
}
return frameFinished != 0;
}And here is code for updating UI of viewcontroller, but don’t know how to play audio
- (IBAction)playButtonAction:(id)sender {
[[self playButton] setEnabled:NO];
[video seekTime:0.0];
double preferredFramesPerSecond = 30.0f;
[NSTimer scheduledTimerWithTimeInterval:1.0/preferredFramesPerSecond
target:self
selector:@selector(displayNextFrame:)
userInfo:nil
repeats:YES];
}
#define LERP(A,B,C) ((A)*(1.0-C)+(B)*C)
-(void)displayNextFrame:(NSTimer *)timer {
NSTimeInterval startTime = [NSDate timeIntervalSinceReferenceDate];
if (![video stepFrame]) {
[timer invalidate];
[_playButton setEnabled:YES];
[video closeAudio];
return;
}
_imageView.image = video.currentImage;
float frameTime = 1.0/([NSDate timeIntervalSinceReferenceDate]-startTime);
if (lastFrameTime<0) {
lastFrameTime = frameTime;
} else {
lastFrameTime = LERP(frameTime, lastFrameTime, 0.8);
}
[_label setText:[NSString stringWithFormat:@"%.0f",lastFrameTime]];
} -
How to decrypt hls video content
16 mai 2019, par SHAH MD MONIRUL ISLAMMy requirement is to play the encrypted
hls
video files from local storage inandroid
. I have usedNanoHTTPD
to create and run the local server. From there I am serving the.ts
an.m3u8
files. To play this videoExoPlayer
need a key to decrypt the files and thus I made a url : http://localhost:4990/dataKey.Here is my local server class :
import android.os.Environment;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Map;
import fi.iki.elonen.NanoHTTPD;
public class LocalStreamingServer extends NanoHTTPD{
public LocalStreamingServer(int port){
super(port);
}
@Override
public Response serve(IHTTPSession session){
Log.e("req", session.getUri());
if(session.getUri().equalsIgnoreCase("/dataKey")){
return newFixedLengthResponse(Response.Status.OK, "txt", "what is the key?");
}
if(session.getUri().contains("m3u8")){
String path = Environment.getExternalStorageDirectory().toString() + "/s3" + session.getUri();
FileInputStream fis = null;
File f = new File(path);
try {
fis = new FileInputStream(f);
} catch (FileNotFoundException e) {
}
return newFixedLengthResponse(Response.Status.OK, "m3u8", fis, f.length());
}
if(session.getUri().endsWith("ts")){
String path = Environment.getExternalStorageDirectory().toString() + "/s3" + session.getUri();
FileInputStream fis = null;
File f = new File(path);
try {
fis = new FileInputStream(f);
} catch (FileNotFoundException e) {
}
return newFixedLengthResponse(Response.Status.OK, "ts", fis, f.length());
}
String path = Environment.getExternalStorageDirectory().toString() + "/s3/master.m3u8";
FileInputStream fis = null;
File f = new File(path);
try {
fis = new FileInputStream(f);
} catch (FileNotFoundException e) {
}
return newFixedLengthResponse(Response.Status.OK, "m3u8", fis, f.length());
}
}I have transcoded the video using
ffmpeg
. I need to know that which data or key need to be returned when the dataKey url is called. I have the encrypted the video using these key :key=617D8A125A284DF48E3C6B1866348A3F
IV=5ff82ce11c7e73dcdf7e73cacd0ef98I can not understand which of them are need to be returned from the datakey url. Both of them are not working.
Exoplayer
is sending the error message :java.security.InvalidKeyException: Unsupported key size
can Any one help me about this ?
-
avcodec/nvenc : only unregister input resources when absolutely needed
24 avril 2019, par Timo Rothenpieleravcodec/nvenc : only unregister input resources when absolutely needed
This reverts nvenc to old behaviour, which in some super rare edge cases
performs better.
The implication of this is that any potential API user who relies on
nvenc cleaning up every frames device resources after it's done using
them will have to change their usage pattern.That should not be a problem, since pretty much every normal usage
pattern automatically implies that surfaces are reused from a common
pool, since constant re-allocation is also very expensive.