
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 (99)
-
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 (...) -
Soumettre bugs et patchs
10 avril 2011Un logiciel n’est malheureusement jamais parfait...
Si vous pensez avoir mis la main sur un bug, reportez le dans notre système de tickets en prenant bien soin de nous remonter certaines informations pertinentes : le type de navigateur et sa version exacte avec lequel vous avez l’anomalie ; une explication la plus précise possible du problème rencontré ; si possibles les étapes pour reproduire le problème ; un lien vers le site / la page en question ;
Si vous pensez avoir résolu vous même le bug (...) -
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.
Sur d’autres sites (10781)
-
FFmpeg Autogen and Unity C# to generate video from screenshots (FFmpeg.Autogen)
1er juin 2022, par cameron gibbsI've taken the
FFmpegHelper
,VideoFrameConverter
,H264VideoStreamEncoder
classes straight from the FFmpeg.AutoGen.Example, rolled my ownFFmpegBinariesHelper class
andSize struct
and mangled theEncodeImagesToH264
from Program.cs to look like the below code. I capture a bunch of frames into textures and feed them intoEncoder.EncodeImagesToH264
. It produces a file I'm callingoutputFileName.h264
just fine, no errors. I've changedH264VideoStreamEncoder
a little based on ffmpeg's own c++ examples because they had a few things it seemed the C# example was missing but that hasn't made any difference.

The video is weird :


- 

- it only plays in VLC, is there another
AVPixelFormat
I should be using for thedestinationPixelFormat
so that anything can play ? - VLC is unable to detect the video length or show current time
- it plays back weird as if the first few seconds are all the same frame then starts playing what appears to be some of the frames I'd expect








public static class Encoder
 {
 public static unsafe void EncodeImagesToH264(Texture2D[] images, int fps, string outputFileName)
 {
 FFmpegBinariesHelper.RegisterFFmpegBinaries();

 var fistFrameImage = images[0];
 outputFileName = Path.ChangeExtension(outputFileName, ".h264");
 var sourceSize = new Size(fistFrameImage.width, fistFrameImage.height);
 var sourcePixelFormat = AVPixelFormat.AV_PIX_FMT_RGB24;
 var destinationSize = sourceSize;
 var destinationPixelFormat = AVPixelFormat.AV_PIX_FMT_YUV420P;

 try
 {
 using (var vfc = new VideoFrameConverter(
 sourceSize,
 sourcePixelFormat,
 destinationSize,
 destinationPixelFormat))
 {
 using var fs = File.Open(outputFileName, FileMode.Create);
 using var vse = new H264VideoStreamEncoder(fs, fps, destinationSize);
 var frameNumber = 0;
 foreach (var frameFile in images)
 {
 var bitmapData = GetBitmapData(frameFile);

 //var pBitmapData = (byte*)NativeArrayUnsafeUtility
 // .GetUnsafeBufferPointerWithoutChecks(bitmapData);

 fixed (byte* pBitmapData = bitmapData)
 {
 var data = new byte_ptrArray8 { [0] = pBitmapData };
 var linesize = new int_array8 { [0] = bitmapData.Length / sourceSize.Height };
 var frame = new AVFrame
 {
 data = data,
 linesize = linesize,
 height = sourceSize.Height
 };

 var convertedFrame = vfc.Convert(frame);
 convertedFrame.pts = frameNumber;

 vse.Encode(convertedFrame);

 Debug.Log($"frame: {frameNumber}");
 frameNumber++;
 }
 }
 byte[] endcode = { 0, 0, 1, 0xb7 };
 fs.Write(endcode, 0, endcode.Length);
 }
 Debug.Log(outputFileName);
 }
 catch (Exception ex)
 {
 Debug.LogException(ex);
 }
 }

 private static byte[] GetBitmapData(Texture2D frameBitmap)
 {
 return frameBitmap.GetRawTextureData();
 }
 }

 public sealed unsafe class H264VideoStreamEncoder : IDisposable
 {
 private readonly Size _frameSize;
 private readonly int _linesizeU;
 private readonly int _linesizeV;
 private readonly int _linesizeY;
 private readonly AVCodec* _pCodec;
 private readonly AVCodecContext* _pCodecContext;
 private readonly Stream _stream;
 private readonly int _uSize;
 private readonly int _ySize;

 public H264VideoStreamEncoder(Stream stream, int fps, Size frameSize)
 {
 _stream = stream;
 _frameSize = frameSize;

 var codecId = AVCodecID.AV_CODEC_ID_H264;
 _pCodec = ffmpeg.avcodec_find_encoder(codecId);
 if (_pCodec == null)
 throw new InvalidOperationException("Codec not found.");

 _pCodecContext = ffmpeg.avcodec_alloc_context3(_pCodec);
 _pCodecContext->bit_rate = 400000;
 _pCodecContext->width = frameSize.Width;
 _pCodecContext->height = frameSize.Height;
 _pCodecContext->time_base = new AVRational { num = 1, den = fps };
 _pCodecContext->gop_size = 10;
 _pCodecContext->max_b_frames = 1;
 _pCodecContext->pix_fmt = AVPixelFormat.AV_PIX_FMT_YUV420P;

 if (codecId == AVCodecID.AV_CODEC_ID_H264)
 ffmpeg.av_opt_set(_pCodecContext->priv_data, "preset", "veryslow", 0);

 ffmpeg.avcodec_open2(_pCodecContext, _pCodec, null).ThrowExceptionIfError();

 _linesizeY = frameSize.Width;
 _linesizeU = frameSize.Width / 2;
 _linesizeV = frameSize.Width / 2;

 _ySize = _linesizeY * frameSize.Height;
 _uSize = _linesizeU * frameSize.Height / 2;
 }

 public void Dispose()
 {
 ffmpeg.avcodec_close(_pCodecContext);
 ffmpeg.av_free(_pCodecContext);
 }

 public void Encode(AVFrame frame)
 {
 if (frame.format != (int)_pCodecContext->pix_fmt)
 throw new ArgumentException("Invalid pixel format.", nameof(frame));
 if (frame.width != _frameSize.Width)
 throw new ArgumentException("Invalid width.", nameof(frame));
 if (frame.height != _frameSize.Height)
 throw new ArgumentException("Invalid height.", nameof(frame));
 if (frame.linesize[0] < _linesizeY)
 throw new ArgumentException("Invalid Y linesize.", nameof(frame));
 if (frame.linesize[1] < _linesizeU)
 throw new ArgumentException("Invalid U linesize.", nameof(frame));
 if (frame.linesize[2] < _linesizeV)
 throw new ArgumentException("Invalid V linesize.", nameof(frame));
 if (frame.data[1] - frame.data[0] < _ySize)
 throw new ArgumentException("Invalid Y data size.", nameof(frame));
 if (frame.data[2] - frame.data[1] < _uSize)
 throw new ArgumentException("Invalid U data size.", nameof(frame));

 var pPacket = ffmpeg.av_packet_alloc();
 try
 {
 int error;
 do
 {
 ffmpeg.avcodec_send_frame(_pCodecContext, &frame).ThrowExceptionIfError();
 ffmpeg.av_packet_unref(pPacket);
 error = ffmpeg.avcodec_receive_packet(_pCodecContext, pPacket);
 } while (error == ffmpeg.AVERROR(ffmpeg.EAGAIN));

 error.ThrowExceptionIfError();

 using var packetStream = new UnmanagedMemoryStream(pPacket->data, pPacket->size);
 packetStream.CopyTo(_stream);
 }
 finally
 {
 ffmpeg.av_packet_free(&pPacket);
 }
 }
 }



- it only plays in VLC, is there another
-
Tv box failed to open encoded videos using x265 HEVC encoder
3 juin 2022, par Constadinos ChatzisI have Zidoo X9S tv box and it has support for x265 HEVC codec. Every single video i throw in it, HDR 4K or standard x264 videos, it plays perfectly except my encoded x265 video when i select it to play, it freezes and it doesn't load. I believe it has something to do with my encoding settings. The encoding command i use with ffmpeg, is this :


-c:v libx265 -crf 10 -preset veryfast output.mkv



Any ideas why this is happening ?


-
Unknown input format : 'rawvideo' when trying to save animation
8 juin 2022, par John KlintSo, I get a strange error trying to save animations created with matplotlib.FuncAnimation using FFMpegWriter.


/home/j/PycharmProjects/venvtest/venv/bin/python /home/j/PycharmProjects/venvtest/main.py
MovieWriter stderr:
Unknown input format: 'rawvideo'

Traceback (most recent call last):
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 234, in saving
 yield self
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 1093, in save
 writer.grab_frame(**savefig_kwargs)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 351, in grab_frame
 self.fig.savefig(self._proc.stdin, format=self.frame_format,
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/figure.py", line 3046, in savefig
 self.canvas.print_figure(fname, **kwargs)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 2319, in print_figure
 result = print_method(
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 1648, in wrapper
 return func(*args, **kwargs)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/_api/deprecation.py", line 415, in wrapper
 return func(*inner_args, **inner_kwargs)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/backends/backend_agg.py", line 486, in print_raw
 fh.write(renderer.buffer_rgba())
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/home/j/PycharmProjects/venvtest/main.py", line 24, in <module>
 anim.save('basic_animation.mp4', writer=FFwriter)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 1093, in save
 writer.grab_frame(**savefig_kwargs)
 File "/usr/lib/python3.9/contextlib.py", line 137, in __exit__
 self.gen.throw(typ, value, traceback)
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 236, in saving
 self.finish()
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 342, in finish
 self._cleanup() # Inline _cleanup() once cleanup() is removed.
 File "/home/j/PycharmProjects/venvtest/venv/lib/python3.9/site-packages/matplotlib/animation.py", line 373, in _cleanup
 raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command '['/usr/bin/ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '640x480', '-pix_fmt', 'rgba', '-r', '5', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-y', 'basic_animation.mp4']' returned non-zero exit status 1.

Process finished with exit code 1
</module>


I am confident it has nothing to do with the animation data, the error occurs even when I create a simple test animation :


import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
# plt.rcParams['animation.ffmpeg_path'] = '/usr/bin/ffmpeg'

fig = plt.figure()
ax = plt.axes(xlim=(0, 2), ylim=(-2, 2))
line, = ax.plot([], [], lw=2)


def init():
 line.set_data([], [])
 return line,


def animate(i):
 x = np.linspace(0, 2, 1000)
 y = np.sin(2 * np.pi * (x - 0.01 * i))
 line.set_data(x, y)
 return line,


anim = animation.FuncAnimation(fig, animate, init_func=init,
 frames=200, interval=20, blit=True)

FFwriter = animation.FFMpegWriter()
anim.save('basic_animation.mp4', writer=FFwriter)



I am currently using PyCharm in LinuxMint and I have a fairly new version of FFMpeg (4.2.4) installed. Given that FFMpeg complains about 'rawvideo' which as far as I understand it is just a bunch of images in series, it seems unlikely this has anything to do with codecs. If I run ffmpeg -formats, sure enough rawvideo is in the list.


I have tried manually setting plt.rcParams, like in the commented line in the code above, with no success. I have also tried setting up both anaconda and venv environments, but I get the same error.
Annoyingly, I did not have this problem a few months ago when I was using Ubuntu. I have also verified that it works on my friends Ubuntu desktop, using the same simple venv as I set up for myself.


Any ideas ?


EDIT : I use the fish shell, if that is relevant...


Well this is peculiar. If I start a terminal from within PyCharm and check supported formats, I get the following :


(venv) ffmpeg -formats
ffmpeg version 4.3.4 Copyright (c) 2000-2021 the FFmpeg developers
 built with gcc 11.3.0 (GCC)
 configuration: --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --disable-debug --disable-doc --disable-static --enable-optimizations --enable-shared --disable-everything --enable-ffplay --enable-ffprobe --enable-gnutls --enable-libaom --enable-libdav1d --enable-libfdk-aac --enable-libmp3lame --enable-libfontconfig --enable-libfreetype --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-openal --enable-opengl --enable-sdl2 --enable-vulkan --enable-zlib --enable-libv4l2 --enable-libxcb --enable-vdpau --enable-vaapi --enable-encoder='ac3,alac,flac,libfdk_aac,g723_1,mp2,libmp3lame,libopus,libspeex,pcm_alaw,pcm_mulaw,pcm_f32le,pcm_s16be,pcm_s24be,pcm_s16le,pcm_s24le,pcm_s32le,pcm_u8,tta,libvorbis,wavpack,' --enable-encoder='ass,ffv1,libaom_av1,libvpx_vp8,libvpx_vp9,mjpeg_vaapi,rawvideo,theora,vp8_vaapi,libopenh264' --enable-decoder='adpcm_g722,alac,flac,g723_1,g729,libfdk_aac,libopus,libspeex,mp2,mp3,m4a,pcm_alaw,pcm_mulaw,pcm_f16le,pcm_f24le,pcm_f32be,pcm_f32le,pcm_f64be,pcm_f64le,pcm_s16be,pcm_s16be_planar,pcm_s24be,pcm_s16le,pcm_s16le_planar,pcm_s24le,pcm_s24le_planar,pcm_s32le,pcm_s32le_planar,pcm_s64be,pcm_s64le,pcm_s8,pcm_s8_planar,pcm_u8,pcm_u24be,pcm_u24le,pcm_u32be,pcm_u32le,tta,vorbis,wavpack,' --enable-decoder='ass,ffv1,mjpeg,mjpegb,libaom_av1,libdav1d,libvpx_vp8,libvpx_vp9,rawvideo,theora,vp8,vp9,libopenh264' --enable-encoder='bmp,gif,jpegls,png,tiff,webp,' --enable-decoder='bmp,gif,jpegls,png,tiff,webp,' --enable-hwaccel='vp8_vaapi,mjpeg_vaapi,' --enable-parser='aac,ac3,flac,mjpeg,mpegaudio,mpeg4video,opus,vp3,vp8,vp9,vorbis,' --enable-muxer='ac3,ass,flac,g722,gif,matroska,mp3,mpegvideo,rtp,ogg,opus,pcm_s16be,pcm_s16le,wav,webm,' --enable-demuxer='aac,ac3,ass,flac,g722,gif,image_jpeg_pipe,image_png_pipe,image_webp_pipe,matroska,mjpeg,mov,mp3,mpegvideo,ogg,pcm_mulaw,pcm_alaw,pcm_s16be,pcm_s16le,rtp,wav,' --enable-filter='crop,scale,overlay,amix,amerge,aresample,format,aformat,fps,transpose,pad,' --enable-protocol='crypto,file,pipe,rtp,srtp,rtsp,tcp,udp,unix,' --arch=x86_64 --enable-libopenh264
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
File formats:
 D. = Demuxing supported
 .E = Muxing supported
 --
 D aac raw ADTS AAC (Advanced Audio Coding)
 DE ac3 raw AC-3
 D alaw PCM A-law
 D asf ASF (Advanced / Active Streaming Format)
 DE ass SSA (SubStation Alpha) subtitle
 DE flac raw FLAC
 DE g722 raw G.722
 DE gif CompuServe Graphics Interchange Format (GIF)
 D jpeg_pipe piped jpeg sequence
 E matroska Matroska
 D matroska,webm Matroska / WebM
 D mjpeg raw MJPEG video
 D mov,mp4,m4a,3gp,3g2,mj2 QuickTime / MOV
 DE mp3 MP3 (MPEG audio layer 3)
 D mpegts MPEG-TS (MPEG-2 Transport Stream)
 D mpegvideo raw MPEG video
 D mulaw PCM mu-law
 DE ogg Ogg
 E opus Ogg Opus
 D png_pipe piped png sequence
 D rm RealMedia
 DE rtp RTP output
 DE s16be PCM signed 16-bit big-endian
 DE s16le PCM signed 16-bit little-endian
 D sdp SDP
 DE wav WAV / WAVE (Waveform Audio)
 E webm WebM
 D webp_pipe piped webp sequence




As is evident, there is no support for 'rawvideo' in the list above ! Very strange indeed, I do not know which ffmpeg this list belongs to, perhaps it is a version integrated into matplotlib's animation class ?


Anyway, if I uncomment the line setting the ffmpeg_path I am back at the old error. I did get it to work however, by changing the path from '/usr/bin/ffmpeg' to '/home/j/.conda/envs/venvtest/bin/ffmpeg'. Then I get the file to run, create the animation and save it. This works for my real files as well, which do not even run that particular conda-environment. They do not recognize or find the ffmpeg I have in /usr/bin though. I have no clue why but at least I have a workaround now.


Final edit :
It is solved. It was flatpak's fault. Lesson is, don't use flatpak (or snap for that matter) to install Pycharm.