
Recherche avancée
Autres articles (38)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
MediaSPIP Player : les contrôles
26 mai 2010, parLes contrôles à la souris du lecteur
En plus des actions au click sur les boutons visibles de l’interface du lecteur, il est également possible d’effectuer d’autres actions grâce à la souris : Click : en cliquant sur la vidéo ou sur le logo du son, celui ci se mettra en lecture ou en pause en fonction de son état actuel ; Molette (roulement) : en plaçant la souris sur l’espace utilisé par le média (hover), la molette de la souris n’exerce plus l’effet habituel de scroll de la page, mais diminue ou (...) -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...)
Sur d’autres sites (4404)
-
Using Qt Media Player on Raspberry Pi 1
18 mai 2015, par MaukerI have a project built using Qt5 which has to play a video. Just like in the videowidget sample code.
I’ve followed these instructions to build qt5 on my Pi. And it went just fine. But when I try to run any qt program that uses QMediaPlayer, I get the error message :
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
Which means I don’t have a backend to play the video, right ? Is there any one that I can use which will with Qt, like ffmpeg ? And how can I get it to work ? Specially for h264 videos.
I’ve tried to install gstreamer as is told on this link, but it’s not working. Will I have to rebuild the entire qt5 again ?
P.S. : I have the raspberry pi 1 model B with raspbian installed.
Edit : As mentioned by Greenflow, I checked the ./configure log and saw that the GStreamer was compiled in, but the video apps are still not working...
The message on the log was like this :
GStreamer .............. yes (0.10)
And the message on Greenflow’s log was like this :
GStreamer .............. yes (1.0)
Clearly it’s another version of GStreamer, but is it the problem ?
I’ve also found this post which says QtMultimedia on the Pi is rather useless, but the post is from 2013, so I’m not sure if it’s really relevant. I’d like to have this app playing hardware accelerated videos on my Raspberry Pi, but I’m almost dropping the idea.
Anyways, thanks Greenflow for the head start.
Edit 2 : Found this thread on the Qtcentre. Damn, this thing is not going to be easy to solve, I guess...
-
ultimate video player not working with one video (Uncaught in promise)
29 octobre 2018, par completeidiothereDohSo I have a small website that I have yet to launch using PHP / MySQL. One section there is a video player, and I am using the Ultimate video player script beecause it easily allowed me to change some codes to insert ads, etc. So far I’ve only added about 20 videos, mostly downloaded from archive.org. The uploads are processed using FFMPEG, specifically this command :
exec(’ffmpeg -i ’.$uploadfile.’ -f mp4 ’.$new_flv) ;I also do some other things with ffmpeg such as create an animated .gif and a video thumbnail. So far everything has worked. Prior to using the current video script I was using video.js and this issue didn’t happen. Once I switched over to the new script I noticed this one video won’t play. It acts like it wants to play (spinner spins for a few seconds) but ultimately goes back to the pre-play video thumbnail rather than playing the video.
I am experiencing this in Google Chrome, though the same thing using Edge. The Chrome console messages reads as follows : Uncaught (in promise) DOMException : The play() request was interrupted by a call to pause().
The video worked prior to switching to this video player. The file also works attempting to open in Windows. The file works opening directly in Chrome. Plus all other videos work except for this one. I contacted the author and was told that it sounds like an encoding issue and that he isn’t very good at that sort of thing.
I won’t post the paid script’s js source file here, but I guess I am wondering if anything I’ve listed points to maybe he is correct (although then why did it work in video.js and not uvp ?) and my rudimentary ffmpeg mp4 conversion command needs some work, or else perhaps some of the research I’ve done on this google chrome console message can fix the issue. I don’t believe I can make the corrections myself but I’m curious if anyone suspects this is really an encoding issue.
I’ve only managed to add about 20 videos, so so far 1/20, or 5% videos aren’t working. I am worried that ignoring a video that isn’t working now, once there are thousands of videos, then maybe 100 won’t work, etc. Furthermore, although probably mostly SERPS (since I haven’t technically launched yet), the video in question has the most views haha. So if it is attracting more organic traffic than the other videos I would obviously like to have it working again.
I may need to move back to video.js, but the reason I switched was I was having a difficult time (not being an excellent coder) attempting to implement an ads system. Oh well, thanks if anyone has any suggestions or ideas.
-
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.