
Recherche avancée
Médias (9)
-
Stereo master soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
Elephants Dream - Cover of the soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (36)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (6869)
-
Video duration is the double of what it should be
12 juin 2019, par lulasI was trying to record my computer screen, for that I am using Accord.
I had everything working fine with the Accord version 3.8.0.0, but when I upgraded to the version 3.8.2.0-alpha my recording videos are slow down, and they take approximately the double to finish.
So a 10 second video actually takes 20 seconds to play (in the video player the duration of the video is also 10 seconds).
I searched in google and didn’t managed to find anything usefull. Probably due to the alpha version of the release.
I managed to find a project from one of the maintainers of the Accord project that uses this 3.8.2.0-alpha version : https://github.com/cesarsouza/screencast-capture
I downloaded the zip file, extracted the project, built the project, fixed a compilation error (change a
Dispose()
toStop()
) and then ran the application, but the problem still exists... the generated video files are still slow down...The main methods of my code with the 3.8.2.0-alpha version are these (they were taken from the previous project I downloaded) :
public void StartRecording()
{
if (IsRecording || !IsPlaying)
return;
int height = area.Height;
int width = area.Width;
Rational framerate = new Rational(1000, screenStream.FrameInterval);
int videoBitRate = 1200 * 1000;
OutputPath = Path.Combine(main.CurrentDirectory, fileName);
RecordingStartTime = DateTime.MinValue;
videoWriter = new VideoFileWriter();
videoWriter.BitRate = videoBitRate;
videoWriter.FrameRate = framerate;
videoWriter.Width = width;
videoWriter.Height = height;
videoWriter.VideoCodec = VideoCodec.H264;
videoWriter.VideoOptions["crf"] = "18";
videoWriter.VideoOptions["preset"] = "veryfast";
videoWriter.VideoOptions["tune"] = "zerolatency";
videoWriter.VideoOptions["x264opts"] = "no-mbtree:sliced-threads:sync-lookahead=0";
videoWriter.Open(OutputPath);
HasRecorded = false;
IsRecording = true;
}
void VideoPlayer_NewFrameReceived(object sender, Accord.Video.NewFrameEventArgs eventArgs)
{
DateTime currentFrameTime = eventArgs.CaptureFinished;
// Encode the last frame at the same time we prepare the new one
Task.WaitAll(
Task.Run(() =>
{
lock (syncObj) // Save the frame to the video file.
{
if (IsRecording)
{
if (RecordingStartTime == DateTime.MinValue)
RecordingStartTime = DateTime.Now;
TimeSpan timestamp = currentFrameTime - RecordingStartTime;
if (timestamp > TimeSpan.Zero)
videoWriter.WriteVideoFrame(this.lastFrame, timestamp, this.lastFrameRegion);
}
}
}),
Task.Run(() =>
{
// Adjust the window according to the current capture
// mode. Also adjusts to keep even widths and heights.
CaptureRegion = AdjustWindow();
// Crop the image if the mode requires it
if (CaptureMode == CaptureRegionOption.Fixed ||
CaptureMode == CaptureRegionOption.Window)
{
crop.Rectangle = CaptureRegion;
eventArgs.Frame = croppedImage = crop.Apply(eventArgs.Frame, croppedImage);
eventArgs.FrameSize = crop.Rectangle.Size;
}
//// Draw extra information on the screen
bool captureMouse = Settings.Default.CaptureMouse;
bool captureClick = Settings.Default.CaptureClick;
bool captureKeys = Settings.Default.CaptureKeys;
if (captureMouse || captureClick || captureKeys)
{
cursorCapture.CaptureRegion = CaptureRegion;
clickCapture.CaptureRegion = CaptureRegion;
keyCapture.Font = Settings.Default.KeyboardFont;
using (Graphics g = Graphics.FromImage(eventArgs.Frame))
{
g.CompositingQuality = CompositingQuality.HighSpeed;
g.SmoothingMode = SmoothingMode.HighSpeed;
float invWidth = 1; // / widthScale;
float invHeight = 1; // / heightScale;
if (captureMouse)
cursorCapture.Draw(g, invWidth, invHeight);
if (captureClick)
clickCapture.Draw(g, invWidth, invHeight);
if (captureKeys)
keyCapture.Draw(g, invWidth, invHeight);
}
}
})
);
// Save the just processed frame and mark it to be encoded in the next iteration:
lastFrame = eventArgs.Frame.Copy(lastFrame);
lastFrameRegion = new Rectangle(0, 0, eventArgs.FrameSize.Width, eventArgs.Frame.Height);
}Anyone knows what might be problem causing this slow down ?
EDIT :
I think I managed to find my problem :
pts:4.032000e+003 pts_time:0.252 dts:2.016000e+003 dts_time:0.126 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:6.720000e+003 pts_time:0.42 dts:3.360000e+003 dts_time:0.21 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:1.075200e+004 pts_time:0.672 dts:5.376000e+003 dts_time:0.336 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:1.344000e+004 pts_time:0.84 dts:6.720000e+003 dts_time:0.42 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:1.612800e+004 pts_time:1.008 dts:8.064000e+003 dts_time:0.504 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:1.881600e+004 pts_time:1.176 dts:9.408000e+003 dts_time:0.588 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:2.150400e+004 pts_time:1.344 dts:1.075200e+004 dts_time:0.672 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:2.553600e+004 pts_time:1.596 dts:1.276800e+004 dts_time:0.798 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:2.822400e+004 pts_time:1.764 dts:1.411200e+004 dts_time:0.882 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:3.091200e+004 pts_time:1.932 dts:1.545600e+004 dts_time:0.966 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:3.494400e+004 pts_time:2.184 dts:1.747200e+004 dts_time:1.092 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:3.897600e+004 pts_time:2.436 dts:1.948800e+004 dts_time:1.218 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:4.166400e+004 pts_time:2.604 dts:2.083200e+004 dts_time:1.302 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:4.704000e+004 pts_time:2.94 dts:2.352000e+004 dts_time:1.47 duration:6.720000e+002 duration_time:0.042 stream_index:0
pts:5.107200e+004 pts_time:3.192 dts:2.553600e+004 dts_time:1.596 duration:6.720000e+002 duration_time:0.042 stream_index:0The PTS is always the double of DTS, that’s why the video is presented in a slow down way.
Unfortunately I have no idea why this happens... Anyone has any clue ?
-
Not able to link ffmpeg library in cython package
12 août 2020, par Sagar DonadkarI am using cython package to call Cpp API and in my cpp code i am using ffmpeg library when i try to build my code i got and linking issue
In header file add include ffmpeg header file to call ffmpeg library function


header file
#ifndef RECTANGLE_H
#define RECTANGLE_H
#include <iostream>

extern "C"
{
 #include "libavformat/avformat.h"
 #include "libavutil/dict.h"
}

using namespace std;

namespace shapes 
{
 class Rectangle {
 public:
 int x0, y0, x1, y1;
 Rectangle();
 Rectangle(int x0, int y0, int x1, int y1);
 ~Rectangle();
 int getArea();
 int ffmpegFile();
 void getSize(int* width, int* height);
 void move(int dx, int dy);
 };
}

#endif
</iostream>


Rectangle.Cpp file in ffmpegFile() i am using ffmpeg example code to test ffmpeg my code where i call mostly ffmpeg API



#include <iostream>
#include "Rectangle.hpp"

namespace shapes {
 

 // Default constructor
 Rectangle::Rectangle () {}

 // Overloaded constructor
 Rectangle::Rectangle (int x0, int y0, int x1, int y1) {
 this->x0 = x0;
 this->y0 = y0;
 this->x1 = x1;
 this->y1 = y1;
 }

 // Destructor
 Rectangle::~Rectangle () {}

 // Return the area of the rectangle
 int Rectangle::getArea () {
 return 10;
 }

 // Get the size of the rectangle.
 // Put the size in the pointer args
 void Rectangle::getSize (int *width, int *height) {
 (*width) = x1 - x0;
 (*height) = y1 - y0;
 }

 // Move the rectangle by dx dy
 void Rectangle::move (int dx, int dy) {
 this->x0 += dx;
 this->y0 += dy;
 this->x1 += dx;
 this->y1 += dy;
 }
 int Rectangle::ffmpegFile()
 {
 AVFormatContext *fmt_ctx = NULL;
 AVDictionaryEntry *tag = NULL;
 int ret = 0;
 char* filename = "D:\\Discovery.mp4";

 if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)))
 return ret;

 if ((ret = avformat_find_stream_info(fmt_ctx, NULL)) < 0) {
 av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");
 return ret;
 }

 while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
 printf("%s=%s\n", tag->key, tag->value);

 avformat_close_input(&fmt_ctx);
 return ret;
 }
}
</iostream>


Rectangle.pxd file declaration for cpp file function and variable


cdef extern from "Rectangle.cpp":
 pass
cdef extern from "Rectangle.hpp" namespace "shapes":
 cdef cppclass Rectangle:
 Rectangle() except +
 Rectangle(int, int, int, int) except +
 int x0, y0, x1, y1
 int getArea()
 void getSize(int* width, int* height)
 void move(int, int)
 int ffmpegFile()



rect.pyx file i am calling cpp API form pyx file


# distutils: language = c++

from Rectangle cimport Rectangle

cdef class PyRectangle:
 cdef Rectangle c_rect # Hold a C++ instance which we're wrapping

 def __cinit__(self, int x0, int y0, int x1, int y1):
 self.c_rect = Rectangle(x0, y0, x1, y1)

 def get_area(self):
 return self.c_rect.getArea()

 def get_size(self):
 cdef int width, height
 self.c_rect.getSize(&width, &height)
 return width, height

 def move(self):
 print(self.c_rect.ffmpegFile())



setup.py
I provided pyx file and ffmpeg library path as well as include path


from setuptools import setup,Extension
from Cython.Build import cythonize 


directives={'linetrace':False, 'language_level':3}

setup(name = 'superfastcode', version = '1.0',
 description = 'Python Package with superfastcode C++ extension',
 ext_modules=cythonize([
 Extension(
 'demo',["rect.pyx"],
 include_dirs=['ffmpeg\\include'],)
 library_dirs=["ffmpeg\\lib"],
 libraries=["avcodec","avformat","avutil","swscale","avdevice","avfilter","postproc","swresample"]),
 
]))



getting below error


PS D:\SiVUE\Backend\Cython\demo> python setup.py build_ext --inplace
Compiling rect.pyx because it depends on .\Rectangle.pxd.
[1/1] Cythonizing rect.pyx
C:\python3.8\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: D:\SiVUE\Backend\Cython\demo\rect.pyx
 tree = Parsing.p_module(s, pxd, full_module_name)
running build_ext
building 'demo' extension
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I. -Iffmpeg\include -IC:\python3.8\include -IC:\python3.8\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tprect.cpp /Fobuild\temp.win32-3.8\Release\rect.obj
rect.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:ffmpeg\lib /LIBPATH:C:\python3.8\libs /LIBPATH:C:\python3.8\PCbuild\win32 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x86" avcodec.lib avformat.lib avutil.lib swscale.lib avdevice.lib avfilter.lib postproc.lib swresample.lib /EXPORT:PyInit_demo build\temp.win32-3.8\Release\rect.obj /OUT:build\lib.win32-3.8\demo.cp38-win32.pyd /IMPLIB:build\temp.win32-3.8\Release\demo.cp38-win32.lib
 Creating library build\temp.win32-3.8\Release\demo.cp38-win32.lib and object build\temp.win32-3.8\Release\demo.cp38-win32.exp
rect.obj : error LNK2001: unresolved external symbol _avformat_open_input
rect.obj : error LNK2001: unresolved external symbol _av_log
rect.obj : error LNK2001: unresolved external symbol _avformat_close_input
rect.obj : error LNK2001: unresolved external symbol _avformat_find_stream_info
rect.obj : error LNK2001: unresolved external symbol _av_dict_get
build\lib.win32-3.8\demo.cp38-win32.pyd : fatal error LNK1120: 5 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x86\\link.exe' failed with exit status 1120



Thank You


-
Getting error "DLL load failed while importing rect : %1 is not a valid Win32 application" while importing package
17 août 2020, par Sagar DonadkarI am using cython package to call Cpp API and in my cpp code i am using ffmpeg library and able to build my code successfully using bellow command


python setup.py build_ext --inplace --compiler=msvc



but when i try to import generated pyd file then i get error


PS D:\SiVUE\Backend\Cython\demo> python
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import rect
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing rect: %1 is not a valid Win32 application.
>>> 
</module></stdin>


My entire code is provided bellow


header file
#ifndef RECTANGLE_H
#define RECTANGLE_H
#include <iostream>

extern "C"
{
 #include "libavformat/avformat.h"
 #include "libavutil/dict.h"
}

using namespace std;

namespace shapes 
{
 class Rectangle {
 public:
 int x0, y0, x1, y1;
 Rectangle();
 Rectangle(int x0, int y0, int x1, int y1);
 ~Rectangle();
 int getArea();
 int ffmpegFile();
 void getSize(int* width, int* height);
 void move(int dx, int dy);
 };
}

#endif
</iostream>


Rectangle.Cpp file in ffmpegFile() i am calling mostly ffmpeg API



#include <iostream>
#include "Rectangle.hpp"

namespace shapes {
 

 // Default constructor
 Rectangle::Rectangle () {}

 // Overloaded constructor
 Rectangle::Rectangle (int x0, int y0, int x1, int y1) {
 this->x0 = x0;
 this->y0 = y0;
 this->x1 = x1;
 this->y1 = y1;
 }

 // Destructor
 Rectangle::~Rectangle () {}

 // Return the area of the rectangle
 int Rectangle::getArea () {
 return 10;
 }

 // Get the size of the rectangle.
 // Put the size in the pointer args
 void Rectangle::getSize (int *width, int *height) {
 (*width) = x1 - x0;
 (*height) = y1 - y0;
 }

 // Move the rectangle by dx dy
 void Rectangle::move (int dx, int dy) {
 this->x0 += dx;
 this->y0 += dy;
 this->x1 += dx;
 this->y1 += dy;
 }
 int Rectangle::ffmpegFile()
 {
 AVFormatContext *fmt_ctx = NULL;
 AVDictionaryEntry *tag = NULL;
 int ret = 0;
 char* filename = "D:\\Discovery.mp4";

 if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)))
 return ret;

 if ((ret = avformat_find_stream_info(fmt_ctx, NULL)) < 0) {
 av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");
 return ret;
 }

 while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
 printf("%s=%s\n", tag->key, tag->value);

 avformat_close_input(&fmt_ctx);
 return ret;
 }
}
</iostream>


Rectangle.pxd file declaration for cpp file function and variable


cdef extern from "Rectangle.cpp":
 pass
cdef extern from "Rectangle.hpp" namespace "shapes":
 cdef cppclass Rectangle:
 Rectangle() except +
 Rectangle(int, int, int, int) except +
 int x0, y0, x1, y1
 int getArea()
 void getSize(int* width, int* height)
 void move(int, int)
 int ffmpegFile()



rect.pyx file i am calling cpp API


# distutils: language = c++

from Rectangle cimport Rectangle

cdef class PyRectangle:
 cdef Rectangle c_rect # Hold a C++ instance which we're wrapping

 def __cinit__(self, int x0, int y0, int x1, int y1):
 self.c_rect = Rectangle(x0, y0, x1, y1)

 def get_area(self):
 return self.c_rect.getArea()

 def get_size(self):
 cdef int width, height
 self.c_rect.getSize(&width, &height)
 return width, height

 def move(self):
 print(self.c_rect.ffmpegFile())



setup.py
I provided pyx file and ffmpeg library path as well as include path


from distutils.core import setup
from setuptools import Extension
from Cython.Build import cythonize 

sfc_module = [Extension('rect', sources = ['rect.pyx'],
 include_dirs = ['D:\\SiVUE\\Backend\\Cython\\demo\\ffmpeg\\include\\'],
 library_dirs = ['D:\\SiVUE\\Backend\\Cython\\demo\\ffmpeg\\lib\\'],
 libraries = ['avcodec','avdevice','avfilter','avformat','avutil','postproc','swresample','swscale'],
 language='c++')]

setup(name = 'superfastcode', version = '1.0',
 description = 'Python Package with superfastcode C++ extension',
 ext_modules = cythonize(sfc_module),
 include_dirs = ['D:\\SiVUE\\Backend\\Cython\\demo\\ffmpeg\\include\\']
 )



Thank You