
Recherche avancée
Autres articles (96)
-
MediaSPIP Core : La Configuration
9 novembre 2010, parMediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...) -
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 -
Sélection de projets utilisant MediaSPIP
29 avril 2011, parLes exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
Ferme MediaSPIP @ Infini
L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)
Sur d’autres sites (6418)
-
tcp : set socket buffer sizes before listen/connect/accept
9 janvier 2017, par Joel Cunninghamtcp : set socket buffer sizes before listen/connect/accept
From e24d95c0e06a878d401ee34fd6742fcaddeeb95f Mon Sep 17 00:00:00 2001
From : Joel Cunningham <joel.cunningham@me.com>
Date : Mon, 9 Jan 2017 13:37:51 -0600
Subject : [PATCH] tcp : set socket buffer sizes before listen/connect/acceptAttempting to set SO_RCVBUF and SO_SNDBUF on TCP sockets after connection
establishment is incorrect and some stacks ignore the set call on the socket at
this point. This has been observed on MacOS/iOS. Windows 7 has some peculiar
behavior where setting SO_RCVBUF after applies only if the buffer is increasing
from the default while decreases are ignored. This is possibly how the incorrect
usage has gone unnoticedUnix Network Programming Vol. 1 : The Sockets Networking API (3rd edition, seciton 7.5) :
"When setting the size of the TCP socket receive buffer, the ordering of the
function calls is important. This is because of TCP’s window scale option,
which is exchanged with the peer on SYN segments when the connection is
established. For a client, this means the SO_RCVBUF socket option must be
set before calling connect. For a server, this means the socket option must
be set for the listening socket before calling listen. Setting this option
for the connected socket will have no effect whatsoever on the possible window
scale option because accept does not return with the connected socket until
TCP’s three-way handshake is complete. This is why the option must be set on
the listening socket. (The sizes of the socket buffers are always inherited from
the listening socket by the newly created connected socket)"Signed-off-by : Joel Cunningham <joel.cunningham@me.com>
Signed-off-by : Michael Niedermayer <michael@niedermayer.cc> -
Creating a video using ffmpeg in a PHP script
30 décembre 2017, par FemzyI have been trying to solve this problem for a while now, but i have not got it through please someone should help me..
My main objective is to collect user’n inputs and convert it to a video with black background, then the input text will be moving from left to right while the video is playing with audio in the background. Currently i was suggested to use "drawtext" but i have not find it working
This is the code I use just to test the drawtext but the thing is, if i try it 10 times it will create a video file ones in many times i tried and even the video file would have 0 kb in size
The Below code is my codeThe Below is the Report i got from the not working ffmpeg cmmand
echo shell_exec('ffmpeg -f lavfi -i testsrc=duration=5:size=800x600:rate=30 -vf drawtext="fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf:textfile=text.txt: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" -preset ultrafast outex.mp4');
ffmpeg started on 2017-12-29 at 16:43:24Report written to "ffmpeg-20171229-164324.log"
Command line :
ffmpeg -f test.mp4 -vf "drawtext=fontsize=64:fontcolor=white@0.8:box=1:boxcolor=black@0.75:boxborderw=16:fontfile=OCRA.ttf:text=my_video:x=(w-tw)/2:y=th" textover09.mpg -report
ffmpeg version git-2017-12-28-be4dfbf Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-18)
configuration : —prefix=/usr/local/ffmpeg —extra-cflags=-I/usr/local/ffmpeg/include —extra-ldflags=-L/usr/local/ffmpeg/lib —bindir=/usr/local/bin —enable-gpl —enable-nonfree —enable-libfdk_aac —enable-libmp3lame —enable-libopus —enable-libvpx —enable-libx264 —enable-libtheora —enable-filter=drawtext
libavutil 56. 7.100 / 56. 7.100
libavcodec 58. 9.100 / 58. 9.100
libavformat 58. 3.100 / 58. 3.100
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 8.100 / 7. 8.100
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
Splitting the commandline.
Reading option ’-f’ ... matched as option ’f’ (force format) with argument ’test.mp4’.
Reading option ’-vf’ ... matched as option ’vf’ (set video filters) with argument ’drawtext=fontsize=64:fontcolor=white@0.8:box=1:boxcolor=black@0.75:boxborderw=16:fontfile=OCRA.ttf:text=my_video:x=(w-tw)/2:y=th’.
Reading option ’textover09.mpg’ ... matched as output url.
Reading option ’-report’ ... matched as option ’report’ (generate a report) with argument ’1’.
Finished splitting the commandline.
Parsing a group of options : global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options : output url textover09.mpg.
Applying option f (force format) with argument test.mp4.
Applying option vf (set video filters) with argument drawtext=fontsize=64:fontcolor=white@0.8:box=1:boxcolor=black@0.75:boxborderw=16:fontfile=OCRA.ttf:text=my_video:x=(w-tw)/2:y=th.
Successfully parsed a group of options.
Opening an output file : textover09.mpg.
[NULL @ 0x4671e80] Requested output format ’test.mp4’ is not a suitable output format
textover09.mpg : Invalid argumentThis is Another report i got, in this report it is saying" Drawtext no such filters"
ffmpeg started on 2017-12-29 at 09:00:43
Report written to "ffmpeg-20171229-090043.log"
Command line:
ffmpeg -i test.mp4 -vf "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf:textfile=text.txt:reload=1:y=h-line_h-10:x=(W/tw)*n" textover7.mpg -report
ffmpeg version git-2017-12-28-be4dfbf Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-18)
configuration: --prefix=/usr/local/ffmpeg --extra-cflags=-I/usr/local/ffmpeg/include --extra-ldflags=-L/usr/local/ffmpeg/lib --bindir=/usr/local/bin --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libtheora --enable-filter=drawtext
libavutil 56. 7.100 / 56. 7.100
libavcodec 58. 9.100 / 58. 9.100
libavformat 58. 3.100 / 58. 3.100
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 8.100 / 7. 8.100
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'test.mp4'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf:textfile=text.txt:reload=1:y=h-line_h-10:x=(W/tw)*n'.
Reading option 'textover7.mpg' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url test.mp4.
Successfully parsed a group of options.
Opening an input file: test.mp4.
[NULL @ 0x42d2d80] Opening 'test.mp4' for reading
[file @ 0x42d3700] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x42d2d80] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x42d2d80] ISO: File Type Major Brand: mp42
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x42d2d80] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x42d2d80] Processing st: 0, edit list 0 - media time: 0, duration: 13049
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x42d2d80] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x42d2d80] Before avformat_find_stream_info() pos: 112452 bytes read:141356 seeks:0 nb_streams:2
[h264 @ 0x42d4640] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x42d4640] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x42d4640] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x42d4640] Format yuv420p chosen by get_format().
[h264 @ 0x42d4640] Reinit context to 640x368, pix_fmt: yuv420p
[h264 @ 0x42d4640] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x42d4640] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x42d4640] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x42d4640] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x42d4640] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x42d4640] nal_unit_type: 1, nal_ref_idc: 2
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x42d2d80] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x42d2d80] After avformat_find_stream_info() pos: 159483 bytes read:174124 seeks:0 frames:9
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2014-01-19T03:12:30.000000Z
Duration: 00:07:15.00, start: 0.000000, bitrate: 201 kb/s
Stream #0:0(und), 8, 1/30: Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360, 103 kb/s, 15 fps, 15 tbr, 30 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und), 1, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
Metadata:
creation_time : 2014-01-19T03:12:31.000000Z
handler_name : IsoMedia File Produced by Google, 5-11-2011
Successfully opened the file.
Parsing a group of options: output url textover7.mpg.
Applying option vf (set video filters) with argument drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf:textfile=text.txt:reload=1:y=h-line_h-10:x=(W/tw)*n.
Successfully parsed a group of options.
Opening an output file: textover7.mpg.
[file @ 0x42e9e40] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 12 logical cores
[h264 @ 0x43ece00] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x43ece00] nal_unit_type: 8, nal_ref_idc: 3
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mpeg1video (native))
Stream #0:1 -> #0:1 (aac (native) -> mp2 (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x43ece00] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x43ece00] Format yuv420p chosen by get_format().
[h264 @ 0x43ece00] Reinit context to 640x368, pix_fmt: yuv420p
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x43f91c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x43376c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x4339d40] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x43c1840] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x43de0c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x439b000] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x445ae80] nal_unit_type: 1, nal_ref_idc: 2
[graph_1_in_0_1 @ 0x4657a40] Setting 'time_base' to value '1/44100'
[graph_1_in_0_1 @ 0x4657a40] Setting 'sample_rate' to value '44100'
[graph_1_in_0_1 @ 0x4657a40] Setting 'sample_fmt' to value 'fltp'
[graph_1_in_0_1 @ 0x4657a40] Setting 'channel_layout' to value '0x3'
[graph_1_in_0_1 @ 0x4657a40] tb:1/44100 samplefmt:fltp samplerate:44100 chlayout:0x3
[format_out_0_1 @ 0x4657cc0] Setting 'sample_fmts' to value 's16'
[format_out_0_1 @ 0x4657cc0] Setting 'sample_rates' to value '44100|48000|32000|22050|24000|16000'
[format_out_0_1 @ 0x4657cc0] Setting 'channel_layouts' to value '0x4|0x3'
[format_out_0_1 @ 0x4657cc0] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
[AVFilterGraph @ 0x42d2c40] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x4658dc0] [SWR @ 0x4659140] Using fltp internally between filters
[auto_resampler_0 @ 0x4658dc0] ch:2 chl:stereo fmt:fltp r:44100Hz -> ch:2 chl:stereo fmt:s16 r:44100Hz
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x4477580] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x4493cc0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x44b0340] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x44cca80] nal_unit_type: 1, nal_ref_idc: 2
[AVFilterGraph @ 0x466e4c0] No such filter: 'drawtext'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
[h264 @ 0x44e91c0] nal_unit_type: 1, nal_ref_idc: 2
[AVIOContext @ 0x43c0280] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x42db980] Statistics: 174124 bytes read, 0 seeks
Conversion failed! -
Dreamcast Serial Extractor
31 décembre 2017, par Multimedia Mike — Sega DreamcastIt has not been a very productive year for blogging. But I started the year by describing an unfinished project that I developed for the Sega Dreamcast, so I may as well end the year the same way. The previous project was a media player. That initiative actually met with some amount of success and could have developed into something interesting if I had kept at it.
By contrast, this post describes an effort that was ultimately a fool’s errand that I spent way too much time trying to make work.
Problem Statement
In my neverending quest to analyze the structure of video games while also hoarding a massive collection of them (though I’m proud to report that I did play at least a few of them this past year), I wanted to be able to extract the data from my many Dreamcast titles, both games and demo discs. I had a tool called the DC Coder’s Cable, a serial cable that enables communication between a Dreamcast and a PC. With the right software, you could dump an entire Dreamcast GD-ROM, which contained a gigabyte worth of sectors.Problem : The dumping software (named ‘dreamrip’ and written by noted game hacker BERO) operated in a very basic mode, methodically dumping sector after sector and sending it down the serial cable. This meant that it took about 28 hours to extract all the data on a single disc by running at the maximum speed of 115,200 bits/second, or about 11 kilobytes/second. I wanted to create a faster method.
The Pitch
I formed a mental model of dreamrip’s operation that looked like this :
As an improvement, I envisioned this beautiful architecture :
Architectural Assumptions
My proposed architecture was predicated on the assumption that the disc reading and serial output functions were both I/O-bound operations and that the CPU would be idle much of the time. My big idea was to use that presumably idle CPU time to compress the sectors before sending them over the wire. As long as the CPU can compress the data faster than 11 kbytes/sec, it should be a win. In order to achieve this, I broke the main program into 3 threads :- The first thread reads the sectors ; more specifically, it asks the drive firmware to please read the sectors and make the data available in system RAM
- The second thread waits for sector data to appear in memory and then compresses it
- The third thread takes the compressed data when it is ready and shuffles it out through the serial cable
Simple and elegant, right ?
For data track compression, I wanted to start with zlib in order to prove the architecture, but then also try bzip2 or lzma. As long as they could compress data faster than the serial port could write it, then it should be a win. For audio track compression, I wanted to use the Flake FLAC encoder. According to my notes, I did get both bzip2 compression and the Flake compressor working on the Dreamcast. I recall choosing Flake over the official FLAC encoder because it was much simpler and had fewer dependencies, always an important consideration for platforms such as this.
Problems
I worked for quite awhile on this project. I have a lot of notes recorded but a lot of the problems I had remain a bit vague in my memory. However, there was one problem I discovered that eventually sunk the entire initiative :The serial output operation is CPU-bound.
My initial mental model was that the a buffer could be “handed off” to the serial subsystem and the CPU could go back to doing other work. Nope. Turns out that the CPU was participating at every step of the serial transfer.
Further, I eventually dug into the serial driver code and learned that there was already some compression taking place via the miniLZO library.
Lessons Learned
- Recognize the assumptions that you’re making up front at the start of the project.
- Prototype in order to ensure plausibility
- Profile to make sure you’re optimizing the right thing (this is something I have learned again and again).
Another interesting tidbit from my notes : it doesn’t matter how many sectors you read at a time, the overall speed is roughly the same. I endeavored to read 1000 2048-byte data sectors, 1 or 10 or 100 at a time, or all 1000 at once. My results :
- 1 : 19442 ms
- 10 : 19207 ms
- 100 : 19194 ms
- 1000 : 19320 ms
No difference. That surprised me.
Side Benefits
At one point, I needed to understand how BERO’s dreamrip software was operating. I knew I used to have the source code but I could no longer find it. Instead, I decided to try to reverse engineer what I needed from the SH-4 binary image that I had. It wasn’t an ELF image ; rather, it was a raw binary meant to be loaded at a particular memory location which makes it extra challenging for ‘objdump’. This led to me asking my most viewed and upvoted question on Stack Overflow : “Disassembling A Flat Binary File Using objdump”. The next day, it also led me to post one of my most upvoted answers when I found the solution elsewhere.Strangely, I have since tried out the command line shown in my answer and have been unable to make it work. But people keep upvoting both the question and the answer.
Eventually this all became moot when I discovered a misplaced copy of the source code on one of my computers.
I strongly recall binging through the Alias TV show while I was slogging away on this project, so I guess that’s a positive association since I got so many fun screenshots out of it.
The Final Resolution
Strangely, I was still determined to make this project work even though the Dreamcast SD adapter arrived for me about halfway through the effort. Part of this was just stubbornness, but part of it was my assumptions about serial port speeds, in particular, my assumption that there was a certain speed-of-light type of limitation on serial port speeds so that the SD adapter, operating over the DC’s serial port, would not be appreciably faster than the serial cable.This turned out to be very incorrect. In fact, the SD adapter is capable of extracting an entire gigabyte disc image in 35-40 minutes. This is the method I have since been using to extract Dreamcast disc images.
The post Dreamcast Serial Extractor first appeared on Breaking Eggs And Making Omelettes.