
Recherche avancée
Médias (91)
-
999,999
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Demon seed (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
The four of us are dying (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Corona radiata (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Lights in the sky (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
Autres articles (75)
-
Gestion générale des documents
13 mai 2011, parMédiaSPIP ne modifie jamais le document original mis en ligne.
Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...) -
Use, discuss, criticize
13 avril 2011, parTalk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
A discussion list is available for all exchanges between users. -
MediaSPIP Player : problèmes potentiels
22 février 2011, parLe lecteur ne fonctionne pas sur Internet Explorer
Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)
Sur d’autres sites (13135)
-
FFMPEG- Can not seek audio on seeking bar of audio player
16 septembre 2015, par Tony ThanI have video file (mp4). I want to detach audio stream (AAC format) from that file and save in PC.
With below code, Generated aac file canplay now on KM player, but can not play on VLC player. It seems that it can not seek on seeking bar of player. And, information of duration displays on player is wrong.
Please help me with this problem.err = avformat_open_input(input_format_context, filename, NULL, NULL);
if (err < 0) {
return err;
}
/* If not enough info to get the stream parameters, we decode the
first frames to get it. (used in mpeg case for example) */
ret = avformat_find_stream_info(*input_format_context, 0);
if (ret < 0) {
av_log(NULL, AV_LOG_FATAL, "%s: could not find codec parameters\n", filename);
return ret;
}
/* dump the file content */
av_dump_format(*input_format_context, 0, filename, 0);
for (size_t i = 0; i < (*input_format_context)->nb_streams; i++) {
AVStream *st = (*input_format_context)->streams[i];
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
*input_codec_context = st->codec;
*input_audio_stream = st;
FILE *file = NULL;
file = fopen("C:\\Users\\MyPC\\Downloads\\Test.aac", "wb");
AVPacket reading_packet;
av_init_packet(&reading_packet);
while (av_read_frame(*input_format_context, &reading_packet) == 0) {
if (reading_packet.stream_index == (int) i) {
uint8_t adts_header[7];
unsigned int obj_type = 0;
unsigned int num_data_block = (reading_packet.size)/1024;
int rate_idx = st->codec->sample_rate, channels = st->codec->channels;
uint16_t frame_length;
// include the header length also
frame_length = reading_packet.size + 7;
/* We want the same metadata */
/* Generate ADTS header */
if(adts_header == NULL) return -1;
/* Sync point over a full byte */
adts_header[0] = 0xFF;
/* Sync point continued over first 4 bits + static 4 bits
* (ID, layer, protection)*/
adts_header[1] = 0xF1;
/* Object type over first 2 bits */
adts_header[2] = obj_type << 6;
/* rate index over next 4 bits */
adts_header[2] |= (rate_idx << 2);
/* channels over last 2 bits */
adts_header[2] |= (channels & 0x4) >> 2;
/* channels continued over next 2 bits + 4 bits at zero */
adts_header[3] = (channels & 0x3) << 6;
/* frame size over last 2 bits */
adts_header[3] |= (frame_length & 0x1800) >> 11;
/* frame size continued over full byte */
adts_header[4] = (frame_length & 0x1FF8) >> 3;
/* frame size continued first 3 bits */
adts_header[5] = (frame_length & 0x7) << 5;
/* buffer fullness (0x7FF for VBR) over 5 last bits*/
adts_header[5] |= 0x1F;
/* buffer fullness (0x7FF for VBR) continued over 6 first bits + 2 zeros
* number of raw data blocks */
adts_header[6] = 0xFA;
adts_header[6] |= num_data_block & 0x03; // Set raw Data blocks.
fwrite(adts_header, 1, 7, file);
fwrite(reading_packet.data, 1, reading_packet.size, file);
}
av_free_packet(&reading_packet);
}
fclose(file);
return 0;
}
} -
AVDictionary set recorded file from stream metadata so video player does not think it is a stream
13 mars 2017, par SyntheticGioI’m currently recording an RTSP stream using the FFMPEG libaries (essentially recording in 1 minute video files). Everything is working well, with the exception that if I launch the video files, the player views them as streams, not as videos (so seeking is disabled, etc.).
I suspect I need to set the proper option when I am using
avformat_write_header(output_context, NULL)
instead of giving no options.I’ve discovered the list of options in libavformat/options_table.h but none of them seem to apply. As an example of how I’m thinking I need to solve this, I’ve looked at https://ffmpeg.org/pipermail/libav-user/2013-January/003541.html and I see things like "sample_rate", "pixel_format" etc. that could be set. Is there something to set the metadata in the file I’m writing from an RTSP stream to behave as a video instead of a stream when I play it after the fact ? Or if it isn’t written with the header, is there some other way I can do this ?
-
FFmpeg player backporting to Android 2.1 - one more problem
22 avril 2024, par tretdmI looked for a lot of information about how to build and use FFmpeg in early versions of Android, looked at the source codes of players from 2011-2014 and was able to easily build FFmpeg 4.0.4 and 3.1.4 on the NDKv5 platform. I have highlighted the main things for this purpose :


- 

<android></android>bitmap.h>
and<android></android>native_window.h>
before Android 2.2 (API Level 8) such a thing did not exist- this requires some effort to implement buffer management for A/V streams, since in practice, when playing video, the application silently crashed after a few seconds due to overflow (below code example in C++ and Java)
- FFmpeg - imho, the only way to support a sufficient number of codecs that are not officially included in Android 2.1 and above








void decodeVideoFromPacket(JNIEnv *env, jobject instance,
 jclass mplayer_class, AVPacket avpkt, 
 int total_frames, int length) {
 AVFrame *pFrame = NULL
 AVFrame *pFrameRGB = NULL;
 pFrame = avcodec_alloc_frame();
 pFrameRGB = avcodec_alloc_frame();
 int frame_size = avpicture_get_size(PIX_FMT_RGB32, gVideoCodecCtx->width, gVideoCodecCtx->height);
 unsigned char* buffer = (unsigned char*)av_malloc((size_t)frame_size * 3);
 if (!buffer) {
 av_free(pFrame);
 av_free(pFrameRGB);
 return;
 }
 jbyteArray buffer2;
 jmethodID renderVideoFrames = env->GetMethodID(mplayer_class, "renderVideoFrames", "([BI)V");
 int frameDecoded;
 avpicture_fill((AVPicture*) pFrame,
 buffer,
 gVideoCodecCtx->pix_fmt,
 gVideoCodecCtx->width,
 gVideoCodecCtx->height
 );

 if (avpkt.stream_index == gVideoStreamIndex) { // If video stream found
 int size = avpkt.size;
 total_frames++;
 struct SwsContext *img_convert_ctx = NULL;
 avcodec_decode_video2(gVideoCodecCtx, pFrame, &frameDecoded, &avpkt);
 if (!frameDecoded || pFrame == NULL) {
 return;
 }

 try {
 PixelFormat pxf;
 // RGB565 by default for Android Canvas in pre-Gingerbread devices.
 if(android::get_android_api_version(env) >= ANDROID_API_CODENAME_GINGERBREAD) {
 pxf = PIX_FMT_BGR32;
 } else {
 pxf = PIX_FMT_RGB565;
 }

 int rgbBytes = avpicture_get_size(pxf, gVideoCodecCtx->width,
 gVideoCodecCtx->height);

 // Converting YUV to RGB frame & RGB frame to char* buffer 
 
 buffer = convertYuv2Rgb(pxf, pFrame, rgbBytes); // result of av_image_copy_to_buffer()

 if(buffer == NULL) {
 return;
 }

 buffer2 = env->NewByteArray((jsize) rgbBytes);
 env->SetByteArrayRegion(buffer2, 0, (jsize) rgbBytes,
 (jbyte *) buffer);
 env->CallVoidMethod(instance, renderVideoFrames, buffer2, rgbBytes);
 env->DeleteLocalRef(buffer2);
 free(buffer);
 } catch (...) {
 if (debug_mode) {
 LOGE(10, "[ERROR] Render video frames failed");
 return;
 }
 }
 }
}



private void renderVideoFrames(final byte[] buffer, final int length) {
 new Thread(new Runnable() {
 @Override
 public void run() {
 Canvas c;
 VideoTrack track = null;
 for (int tracks_index = 0; tracks_index < tracks.size(); tracks_index++) {
 if (tracks.get(tracks_index) instanceof VideoTrack) {
 track = (VideoTrack) tracks.get(tracks_index);
 }
 }
 if (track != null) {
 int frame_width = track.frame_size[0];
 int frame_height = track.frame_size[1];
 if (frame_width > 0 && frame_height > 0) {
 try {
 // RGB_565 == 65K colours (16 bit)
 // RGB_8888 == 16.7M colours (24 bit w/ alpha ch.)
 int bpp = Build.VERSION.SDK_INT > 9 ? 16 : 24;
 Bitmap.Config bmp_config =
 bpp == 24 ? Bitmap.Config.RGB_565 : Bitmap.Config.ARGB_8888;
 Paint paint = new Paint();
 if(buffer != null && holder != null) {
 holder.setType(SurfaceHolder.SURFACE_TYPE_NORMAL);
 if((c = holder.lockCanvas()) == null) {
 Log.d(MPLAY_TAG, "Lock canvas failed");
 return;
 }
 ByteBuffer bbuf =
 ByteBuffer.allocateDirect(minVideoBufferSize);
 bbuf.rewind();
 for(int i = 0; i < buffer.length; i++) {
 bbuf.put(i, buffer[i]);
 }
 bbuf.rewind();

 // The approximate location where the application crashed.
 Bitmap bmp = Bitmap.createBitmap(frame_width, frame_height, bmp_config);
 bmp.copyPixelsFromBuffer(bbuf);
 
 float aspect_ratio = (float) frame_width / (float) frame_height;
 int scaled_width = (int)(aspect_ratio * (c.getHeight()));
 c.drawBitmap(bmp,
 null,
 new RectF(
 ((c.getWidth() - scaled_width) / 2), 0,
 ((c.getWidth() - scaled_width) / 2) + scaled_width,
 c.getHeight()),
 null);
 holder.unlockCanvasAndPost(c);
 bmp.recycle();
 bbuf.clear();
 } else {
 Log.d(MPLAY_TAG, "Video frame buffer is null");
 }
 } catch (Exception ex) {
 ex.printStackTrace();
 } catch (OutOfMemoryError oom) {
 oom.printStackTrace();
 stop();
 }
 }
 }
 }
 }).start();
 }



Exception (tested in Android 4.1.2 emulator) :


E/dalvikvm-heap: Out of memory on a 1228812-byte allocation
I/dalvikvm: "Thread-495" prio=5 tid=21 RUNNABLE
 ................................................
 at android.graphics.Bitmap.nativeCreate(Native Method)
 at android.graphics.Bitmap.createBitmap(Bitmap.java:640)
 at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
 at [app_package_name].MediaPlayer$5.run(MediaPlayer.java:406)
 at java.lang.Thread.run(Thread.java:856)



For clarification : I first compiled FFmpeg 0.11.x on a virtual machine with Ubuntu 12.04 LTS from my written build script, looked for player examples suitable for Android below 2.2 (there is little information about them, unfortunately) and opened the file on the player and after showing the first frames it crashed into a stack or buffer overflow, on I put off developing the player for some time.


Is there anything ready-made that, as a rule, fits into one C++ file and takes into account all the nuances of backporting ? Thanks in advance.