
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 (50)
-
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
Problèmes fréquents
10 mars 2010, parPHP et safe_mode activé
Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site -
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
Sur d’autres sites (8401)
-
ffmpeg in C# (ScrCpy)
23 janvier 2020, par RunicSheepI’m trying to access the screen of my android device like ScrCpy does (https://github.com/Genymobile/scrcpy) but in C#.
What I’ve done so far is pushing the jar (server) to my device and receiving the input. (Device resolution etc.)
But I can’t re implement the decoding process in c#, there has to be some sort of error so far.
C# library used for ffmpeg is ffmpeg.AutoGen (https://github.com/Ruslan-B/FFmpeg.AutoGen)Here’s the decoding code :
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Threading;
using FFmpeg.AutoGen;
namespace Source.Android.Scrcpy
{
public unsafe class Decoder
{
private const string LD_LIBRARY_PATH = "LD_LIBRARY_PATH";
private AVFrame* _decodingFrame;
private AVCodec* _codec;
private AVCodecContext* _codec_ctx;
private AVFormatContext* _format_ctx;
public Decoder()
{
RegisterFFmpegBinaries();
SetupLogging();
this.InitFormatContext();
}
private void InitFormatContext()
{
_decodingFrame = ffmpeg.av_frame_alloc();
_codec = ffmpeg.avcodec_find_decoder(AVCodecID.AV_CODEC_ID_H264);
if (_codec== null)
{
throw new Exception("H.264 decoder not found");// run_end;
}
_codec_ctx = ffmpeg.avcodec_alloc_context3(_codec);
if (_codec_ctx == null)
{
throw new Exception("Could not allocate decoder context"); //run_end
}
if (ffmpeg.avcodec_open2(_codec_ctx, _codec, null) < 0)
{
throw new Exception("Could not open H.264 codec");// run_finally_free_codec_ctx
}
_format_ctx = ffmpeg.avformat_alloc_context();
if (_format_ctx == null)
{
throw new Exception("Could not allocate format context");// run_finally_close_codec;
}
}
private void RegisterFFmpegBinaries()
{
switch (Environment.OSVersion.Platform)
{
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.Win32Windows:
var current = Environment.CurrentDirectory;
var probe = Path.Combine("FFmpeg", Environment.Is64BitProcess ? "x64" : "x86");
while (current != null)
{
var ffmpegDirectory = Path.Combine(current, probe);
if (Directory.Exists(ffmpegDirectory))
{
Console.WriteLine($"FFmpeg binaries found in: {ffmpegDirectory}");
RegisterLibrariesSearchPath(ffmpegDirectory);
return;
}
current = Directory.GetParent(current)?.FullName;
}
break;
case PlatformID.Unix:
case PlatformID.MacOSX:
var libraryPath = Environment.GetEnvironmentVariable(LD_LIBRARY_PATH);
RegisterLibrariesSearchPath(libraryPath);
break;
}
}
private static void RegisterLibrariesSearchPath(string path)
{
switch (Environment.OSVersion.Platform)
{
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.Win32Windows:
SetDllDirectory(path);
break;
case PlatformID.Unix:
case PlatformID.MacOSX:
string currentValue = Environment.GetEnvironmentVariable(LD_LIBRARY_PATH);
if (string.IsNullOrWhiteSpace(currentValue) == false && currentValue.Contains(path) == false)
{
string newValue = currentValue + Path.PathSeparator + path;
Environment.SetEnvironmentVariable(LD_LIBRARY_PATH, newValue);
}
break;
}
}
[DllImport("kernel32", SetLastError = true)]
private static extern bool SetDllDirectory(string lpPathName);
private AVPacket GetPacket()
{
var packet = ffmpeg.av_packet_alloc();
ffmpeg.av_init_packet(packet);
packet->data = null;
packet->size = 0;
return *packet;
}
private static int read_raw_packet(void* opaque, ushort* buffer, int bufSize)
{
var buffSize = 1024;
var remaining = dt.Length - dtp - 1;
var written = 0;
for (var i = 0; i < buffSize && i+dtp < dt.Length; i++)
{
buffer[i] = dt[i+dtp];
written++;
}
dtp += written;
if (written <= 0)
{
return ffmpeg.AVERROR_EOF;
}
return written;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int av_read_function_callback(void* opaque, ushort* endData, int bufSize);
private static byte[] dt;
private static int dtp;
public Bitmap DecodeScrCpy(byte[] data)
{
if (data.Length == 0)
{
return null;
}
byte* _buffer;
ulong _bufferSize = 1024*2;
_buffer = (byte*)ffmpeg.av_malloc(_bufferSize);
if (_buffer == null)
{
throw new Exception("Could not allocate buffer"); // run_finally_free_format_ctx;
}
fixed (byte* dataPtr = data)
{
dt = data;
dtp = 0;
fixed (AVFormatContext** formatCtxPtr = &_format_ctx)
{
var mReadCallbackFunc = new av_read_function_callback(read_raw_packet);
AVIOContext* avio_ctx = ffmpeg.avio_alloc_context(_buffer, (int)_bufferSize, 0, null, //TODO: IntPtr.Zero nutzen?
new avio_alloc_context_read_packet_func{Pointer = Marshal.GetFunctionPointerForDelegate(mReadCallbackFunc) },
null, null);
if (avio_ctx == null)
{
ffmpeg.av_free(dataPtr);
throw new Exception("Could not allocate avio context"); //goto run_finally_free_format_ctx;
}
_format_ctx->pb = avio_ctx;
if (ffmpeg.avformat_open_input(formatCtxPtr, null, null, null) < 0)
{
throw new Exception("Could not open video stream"); // goto run_finally_free_avio_ctx;
}
var packet = GetPacket();
while (ffmpeg.av_read_frame(_format_ctx, &packet) == 0)
{
if (ffmpeg.LIBAVDEVICE_VERSION_INT >= ffmpeg.AV_VERSION_INT(57, 37, 0))
{
int ret;
if ((ret = ffmpeg.avcodec_send_packet(_codec_ctx, &packet)) < 0)
{
throw new Exception($"Could not send video packet: {ret}"); //goto run_quit
}
ret = ffmpeg.avcodec_receive_frame(_codec_ctx, _decodingFrame);
if (ret == 0)
{
// a frame was received
}
else if (ret != ffmpeg.AVERROR(ffmpeg.EAGAIN))
{
ffmpeg.av_packet_unref(&packet);
throw new Exception($"Could not receive video frame: {ret}"); //goto run_quit;
}
}
}
}
}
return null;
}
}
}Entry is DecodeScrCpy with read data from network stream.
Things I noticed :- read_raw_packet is called again after ffmpeg.AVERROR_EOF is returned
- ffmpeg.avformat_open_input fails
Question is, did I miss anything ?
-
why am i getting very low encoding bitrate using vaapi in ffmpeg
19 janvier 2021, par ohroblotI am using this command :


ffmpeg -y \
-vaapi_device /dev/dri/renderD128 \
-loop 1 -r 1 -i ./image.jpg -pix_fmt vaapi_vld \ 
-b:v 18000k -minrate 18000k \
-vf 'format=nv12|vaapi,hwupload,scale_vaapi=w=1280:h=720' \ 
-rc_mode 3 \
-r 30 -g 60 \
-c:v h264_vaapi -f flv /dev/null



I am getting very low bitrate with this, the bitrate is as low as 100Kbits/s. I get faster encoding using libx264 and my cpu. Is it an underpowered GPU ? am I missing some ffmpeg arguments ?


I am not sure what's going on, could this be an issue with linux, mesa drivers, did i miss some options when I compiled ffmpeg ?


vainfo


error: can't connect to X server!
libva info: VA-API version 1.8.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_8
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.8 (libva 2.8.0)
vainfo: Driver version: Mesa Gallium driver 20.2.6 for AMD Radeon (TM) RX 480 Graphics (POLARIS10, DRM 3.38.0, 5.8.0-7630-generic, LLVM 11.0.0)
vainfo: Supported profile and entrypoints
 VAProfileMPEG2Simple : VAEntrypointVLD
 VAProfileMPEG2Main : VAEntrypointVLD
 VAProfileVC1Simple : VAEntrypointVLD
 VAProfileVC1Main : VAEntrypointVLD
 VAProfileVC1Advanced : VAEntrypointVLD
 VAProfileH264ConstrainedBaseline: VAEntrypointVLD
 VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
 VAProfileH264Main : VAEntrypointVLD
 VAProfileH264Main : VAEntrypointEncSlice
 VAProfileH264High : VAEntrypointVLD
 VAProfileH264High : VAEntrypointEncSlice
 VAProfileHEVCMain : VAEntrypointVLD
 VAProfileHEVCMain : VAEntrypointEncSlice
 VAProfileHEVCMain10 : VAEntrypointVLD
 VAProfileJPEGBaseline : VAEntrypointVLD
 VAProfileNone : VAEntrypointVideoProc



ffmpeg -buildconf


ffmpeg version N-100671-gc48110a4a4 Copyright (c) 2000-2021 the FFmpeg developers
 built with gcc 10 (Ubuntu 10.2.0-13ubuntu1)
 configuration: --prefix=/home/_user/Dev/ffmpeg_build/build --extra-cflags='-I/home/_user/Dev/ffmpeg_build/build/include -I/usr/include' --extra-ldflags='-L/home/_user/Dev/ffmpeg_build/build/lib -L/home/_user/Dev/ffmpeg_build/build/lib/x86_64-linux-gnu -Wl,-rpath=/home/_user/Dev/ffmpeg_build/build/lib/x86_64-linux-gnu -ldrm -L/usr/lib' --pkg-config-flags=--static --extra-libs='-lpthread -lm' --bindir=/home/_user/Dev/ffmpeg_build/bin --arch=amd64 --disable-shared --disable-ffprobe --disable-ffplay --disable-gnutls --enable-openssl --enable-zlib --enable-librtmp --enable-static --enable-chromaprint --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-vdpau --enable-ladspa --enable-libaom --enable-libbs2b --enable-libcaca --enable-libcodec2 --enable-libdav1d --enable-libfontconfig --enable-libfribidi --enable-libgme --enable-libopenjpeg --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libwebp --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-libass --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librabbitmq --enable-libvorbis --enable-libvpx --enable-libflite --enable-chromaprint --enable-frei0r
 libavutil 56. 63.101 / 56. 63.101
 libavcodec 58.117.101 / 58.117.101
 libavformat 58. 65.101 / 58. 65.101
 libavdevice 58. 11.103 / 58. 11.103
 libavfilter 7. 96.100 / 7. 96.100
 libswscale 5. 8.100 / 5. 8.100
 libswresample 3. 8.100 / 3. 8.100
 libpostproc 55. 8.100 / 55. 8.100

 configuration:
 --prefix=/home/_user/Dev/ffmpeg_build/build
 --extra-cflags='-I/home/_user/Dev/ffmpeg_build/build/include -I/usr/include'
 --extra-ldflags='-L/home/_user/Dev/ffmpeg_build/build/lib -L/home/_user/Dev/ffmpeg_build/build/lib/x86_64-linux-gnu -Wl,-rpath=/home/_user/Dev/ffmpeg_build/build/lib/x86_64-linux-gnu -ldrm -L/usr/lib'
 --pkg-config-flags=--static
 --extra-libs='-lpthread -lm'
 --bindir=/home/_user/Dev/ffmpeg_build/bin
 --arch=amd64
 --disable-shared
 --disable-ffprobe
 --disable-ffplay
 --disable-gnutls
 --enable-openssl
 --enable-zlib
 --enable-librtmp
 --enable-static
 --enable-chromaprint
 --enable-gpl
 --enable-libass
 --enable-libfdk-aac
 --enable-libfreetype
 --enable-libmp3lame
 --enable-libopus
 --enable-libvorbis
 --enable-libvpx
 --enable-libx264
 --enable-libx265
 --enable-nonfree
 --enable-vdpau
 --enable-ladspa
 --enable-libaom
 --enable-libbs2b
 --enable-libcaca
 --enable-libcodec2
 --enable-libdav1d
 --enable-libfontconfig
 --enable-libfribidi
 --enable-libgme
 --enable-libopenjpeg
 --enable-librsvg
 --enable-librubberband
 --enable-libshine
 --enable-libsnappy
 --enable-libsoxr
 --enable-libspeex
 --enable-libsrt
 --enable-libssh
 --enable-libtheora
 --enable-libtwolame
 --enable-libvidstab
 --enable-libwebp
 --enable-libxml2
 --enable-libxvid
 --enable-libzmq
 --enable-libzvbi
 --enable-lv2
 --enable-omx
 --enable-openal
 --enable-opencl
 --enable-opengl
 --enable-sdl2
 --enable-pocketsphinx
 --enable-libdc1394
 --enable-libdrm
 --enable-libiec61883
 --enable-libass
 --enable-libfreetype
 --enable-libgsm
 --enable-libmp3lame
 --enable-libmysofa
 --enable-libopenjpeg
 --enable-libopenmpt
 --enable-libopus
 --enable-librabbitmq
 --enable-libvorbis
 --enable-libvpx
 --enable-libflite
 --enable-chromaprint
 --enable-frei0r



a link to full logs : http://0x0.st/-i2j.txt


-
Interfacing to an Xbox Optical Drive
1er octobre 2013, par Multimedia Mike — xboxThe next generation Xbox is going to hit the streets soon. But for some reason, I’m still interested in the previous generation’s unit (i.e., the original Xbox). Specifically, I’ve always wondered if it’s possible to use the original Xbox’s optical drive in order to read Xbox discs from Linux. I was never curious enough to actually buy an Xbox just to find out but I eventually came across a cast-off console on a recycle pile.
I have long known that the Xbox has what appears to be a more or less standard optical drive with a 40-pin IDE connector. The only difference is the power adapter which I surmise is probably the easiest way to turn a bit of standardized hardware into a bit of proprietary hardware. The IDE and power connectors look like this :
Thus, I wanted to try opening an Xbox and plugging the optical drive into a regular PC, albeit one that supports IDE cables, and allow the Xbox to supply power to the drive. Do you still have hardware laying around that has 40-pin IDE connectors ? I guess my Mac Mini PPC fits the bill, but I’ll be darned if I’m going to pry that thing open again. I have another IDE-capable machine buried in my closet, last called into service when I needed a computer with a native RS-232 port 3 years ago. The ordeal surrounding making this old computer useful right now can be another post entirely.
Here’s what the monstrosity looks like thanks to characteristically short IDE cable lengths :
Process :
- Turn on Xbox first
- Turn on PC
Doing these things in the opposite order won’t work since the kernel really wants to see the drive when booting up. Inspecting the
'dmesg'
log afterward reveals interesting items :<br />
hdd: PHILIPS XBOX DVD DRIVE, ATAPI CD/DVD-ROM drive<br />
hdd: host max PIO5 wanted PIO255(auto-tune) selected PIO4<br />
hdd: UDMA/33 mode selected<br />
[...]<br />
hdd: ATAPI DVD-ROM drive, 128kB Cache<br />Why is that interesting ? When is the last time to saw disk devices prefixed by ‘hd’ rather than ‘sd’ ? Blast from the past. Oh, and the optical drive’s vendor string clearly indicates that this is an Xbox drive saying ‘hi !’.
Time To Read
When I first studied an Xbox disc in a normal optical drive, I noticed that I was able to read 6992 2048-byte sectors — about 14 MB of data — as reported by the disc table of contents (TOC). This is just enough data to play a standard DVD video animation that kindly instructs the viewer to please use a proper Xbox. At this point, I estimated that there must be something special about Xbox optical drive firmware that knows how to read alternate information on these discs and access further sectors.I ran my TOC query tool with an Xbox Magazine demo disc in the optical drive and it reported substantially more than 6992 sectors, enough to account for more than 2 GB of data. That’s promising. I then tried running
'dd'
against the device and it was able to read… about 14 MB, an exact quantity of bytes that, when divided by 2048 bytes/sector, yields 6992 sectors.Future (Past ?) Work
Assuming Google is your primary window into the broader internet, the world is beginning to lose its memory of things pertaining to the original Xbox (Microsoft’s naming scheme certainly doesn’t help searches). What I’m saying is that it can be difficult to find information about this stuff now. However, I was able to learn that a host needs to perform a sort of cryptographic handshake with the drive at the SCSI level before it is allowed to access the forbidden areas of the disc. I think. I’m still investigating this and will hopefully post more soon.