
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (54)
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Les statuts des instances de mutualisation
13 mars 2010, parPour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...) -
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)
Sur d’autres sites (7826)
-
mpeg2 ts android ffmpeg openmax
10 octobre 2014, par WLGfxThe setup is as follows :
- Multicast server 1000Mbs, UDP, Mpeg2-TS Part 1 (H.222) streaming live TV-channels.
- Quad core 1.5Ghz Android 4.2.2 GLES 2.0 renderer.
- FFMpeg library.
- Eclipse Kepler, Android SDK/NDK, etc. Running on Windows 8.1.
- Output screen 1920 x 1080, I am using a texture of 2048 x 1024 and getting between 35 and 45 Frames per second.
The app :
- Renderer thread runs continuously and updates a single texture by uploading segments to the gpu when media images are ready.
- Media handler thread, downloads and processes media from server/or local storage.
- Video thread(s), one for buffering the UDP packets and another for decoding the packets into frames.
I am connecting ffmpeg to the UDP stream just fine and the packets are being buffered and seemingly decoded fine. The packet buffers are plenty, no under/over-flows. The problem I am facing is it appears to be chopping up frames (ie only playing back 1 out of every so many frames). I understand that I need to distinguish I/P/B frames, but at the moment, hands up, I ain’t got a clue. I’ve even tried a hack to detect I frames to no avail. Plus, I am only rendering the frames to less than a quarter of the screen. So I’m not using full screen decoding.
The decoded frames are also stored in separate buffers to cut out page tearing. The number of buffers I’ve changed too, from 1 to 10 with no luck.
From what I’ve found about OpenMax IL, is it only handles MPeg2-TS Part 3 (H.264 and AAC), but you can use your own decoder. I understand that you can add your own decode component to it. Would it be worth me trying this route or should I continue on with ffmpeg ?
The frame decoder (only the renderer will convert and scale the frames when ready)
/*
* This function will run through the packets and keep decoding
* until a frame is ready first, or out of packets
*/while (packetsUsed[decCurrent])
{
hack_for_i_frame:
i = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packets[decCurrent]);
packetsUsed[decCurrent] = 0; // finished with this one
i = packets[decCurrent].flags & 0x0001;
decCurrent++;
if (decCurrent >= MAXPACKETS) decCurrent = 0;
if (frameFinished)
{
ready_pFrame = pFrame;
frameReady = true; // notify renderer
frameCounter++;
if (frameCounter>=MAXFRAMES) frameCounter = 0;
pFrame = pFrames[frameCounter];
return 0;
}
else if (i)
goto hack_for_i_frame;
}
return 0;The packet reader (spawned as a pthread)
void *mainPacketReader(void *voidptr)
int res ;while ( threadState == TS_RUNNING )
{
if (packetsUsed[prCurrent])
{
LOGE("Packet buffer overflow, dropping packet...");
av_read_frame( pFormatCtx, &packet );
}
else if ( av_read_frame( pFormatCtx, &packets[prCurrent] ) >= 0 )
{
if ( packets[prCurrent].stream_index == videoStream )
{
packetsUsed[prCurrent] = 1; // flag as used
prCurrent++;
if ( prCurrent >= MAXPACKETS )
{
prCurrent = 0;
}
}
// here check if the packet is audio and add to audio buffer
}
}
return NULL;And the renderer just simply does this
// texture has already been bound before calling this functionif ( frameReady == false ) return;
AVFrame *temp; // set to frame 'not' currently being decoded
temp = ready_pFrame;
sws_scale(sws_ctx,(uint8_t const* const *)temp->data,
temp->linesize, 0, pCodecCtx->height,
pFrameRGB->data, pFrameRGB->linesize);
glTexSubImage2D(GL_TEXTURE_2D, 0,
XPOS, YPOS, WID, HGT,
GL_RGBA, GL_UNSIGNED_BYTE, buffer);
frameReady = false;In the past, libvlc had audio syncing problems too, so that is my decision for going with ffmpeg and doing all the donkey work from scratch.
If anybody has any pointers of how to stop the choppiness of the video playback (works great in VLC player) or possibly another route to go down, it would be seriously appreciated.
EDIT I removed the hack for the I-frame (completely useless). Move the sws_scale function from the renderer to the packet decoder. And I left the udp packet reader thread alone.
In the meantime I’ve also changed the packet reader thread and the packet decoder threads priority to real-time. Since doing that I don’t get shed loads of dropped packets.
-
How to fix the problem I'm having with FFmpeg ?
23 février 2023, par JohnI'm working with the ffmpeg library to convert mp4 video files to mp3 audio files.
Here is my code :


package com.exer;


import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Environment;
import android.widget.Toast;
import com.github.hiteshsondhi88.libffmpeg.ExecuteBinaryResponseHandler;
import com.github.hiteshsondhi88.libffmpeg.FFmpeg;
import com.github.hiteshsondhi88.libffmpeg.FFmpegLoadBinaryResponseHandler;

public class MainActivity extends Activity {
 
 FFmpeg ffmpeg;
 private ProgressDialog progressDialog;
 
 
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 
 
 
 try {
 setUp();
 String[] command = {
 "-i", getPaths()+"/dir/input.mp4", "-vn", getPaths()+"/dir/output.mp3"
 };
 //convert("ffmpeg -i input.mp4 -vn output.mp3");
 convert(command);
 
 } catch (Exception e) {
 Toast.makeText(getApplicationContext(), e.getCause().toString(), Toast.LENGTH_SHORT).show();
 }
 }
 
 
 public void setUp() throws Exception {
 
 if(ffmpeg == null) {
 
 ffmpeg = FFmpeg.getInstance(this);
 ffmpeg.loadBinary(new FFmpegLoadBinaryResponseHandler(){
 
 @Override
 public void onFailure() {
 Toast.makeText(getApplicationContext(), "failed to load library", Toast.LENGTH_SHORT).show(); 
 }
 
 @Override
 public void onSuccess() {
 Toast.makeText(getApplicationContext(), "loaded!", Toast.LENGTH_SHORT).show();
 }
 
 @Override
 public void onStart() {
 
 }
 
 @Override
 public void onFinish() {
 
 }
 
 
 });
 
 }
 
 }
 
 
 private void convert(String[] cmd) throws Exception {
 
 ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler(){
 
 @Override
 public void onFailure(String message){
 super.onFailure(message);
 }
 
 @Override
 public void onFinish(){
 super.onFinish();
 Toast.makeText(getApplicationContext(), "finished!", Toast.LENGTH_SHORT).show();
 }
 
 @Override
 public void onStart(){
 super.onStart();
 Toast.makeText(getApplicationContext(), "start conversion...", Toast.LENGTH_SHORT).show();
 }
 
 @Override
 public void onProgress(String message){
 super.onProgress(message);
 }
 });
 
 
 }
 
 private String getPaths() {
 return Environment.getExternalStorageDirectory().getPath();
 }
 
}



When I run the app, the Toast messages are shown :


loaded!

start converting...

finished!
as I write them in the functions, apart that nothing else happens the file is not converted what's wrong ?

Here my manifest file :


<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.exer">
 
 
 
 
 
 
 
 <action></action>

 <category></category>
 
 
 

</manifest>



I've tried to delete the specified file on the phone to see what erros I might got, but still those three Toasts.


-
Google Analytics 4 (GA4) vs Matomo
7 avril 2022, par Erin