
Recherche avancée
Autres articles (43)
-
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
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 (...) -
Use, discuss, criticize
13 avril 2011, parTalk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
A discussion list is available for all exchanges between users.
Sur d’autres sites (7714)
-
Approaches To Modifying Game Resource Files
16 août 2016, par Multimedia Mike — Game HackingI have been assisting The Translator in the translation of another mid-1990s adventure game. This one isn’t quite as multimedia-heavy as the last title, and the challenges are a bit different. I wanted to compose this post in order to describe my thought process and mental model in approaching this problem. Hopefully, this will help some others understand my approach since what I’m doing here often appears as magic to some of my correspondents.
High Level Model
At the highest level, it is valuable to understand the code and the data at play. The code is the game’s engine and the data refers to the collection of resources that comprise the game’s graphics, sound, text, and other assets.
Simplistic high-level game engine model
Ideally, we want to change the data in such a way that the original game engine adopts it as its own because it has the same format as the original data. It is very undesirable to have to modify the binary engine executable in any way.
Modifying The Game Data Directly
How to modify the data ? If we modify the text strings for the sake of language translation, one approach might be to search for strings within the game data files and change them directly. This model assumes that the text strings are stored in a plain, uncompressed format. Some games might store these strings in a text format which can be easily edited with any text editor. Other games will store them as binary data.
In the latter situation, a game hacker can scan through data files with utilities like Unix ‘strings’ to find the resources with the desired strings. Then, use a hex editor to edit the strings directly. For example, change “Original String”…
0098F800 00 00 00 00 00 00 00 4F 72 69 67 69 6E 61 6C 20 .......Original 0098F810 53 74 72 69 6E 67 00 00 00 00 00 00 00 00 00 00 String..........
…to “Short String” and pad the difference in string lengths using spaces (0x20) :
0098F800 00 00 00 00 00 00 00 53 68 6F 72 74 20 53 74 72 .......Short Str 0098F810 69 6E 67 20 20 20 00 00 00 00 00 00 00 00 00 00 ing ..........
This has some obvious problems. First, translated strings need to be of equal our smaller length compared to the original. What if we want to encode “Much Longer String” ?
0098F800 00 00 00 00 00 00 00 4D 75 63 68 20 4C 6F 6E 67 .......Much Long 0098F810 65 72 20 53 74 72 00 00 00 00 00 00 00 00 00 00 er Str..........
It won’t fit. The second problem pertains to character set limitations. If the font in use was only designed for ASCII, it’s going to be inadequate for expressing nearly any other language.
So a better approach is needed.
Understanding The Data Structures
An alternative to the approach outlined above is to understand the game’s resources so they can be modified at a deeper level. Here’s a model to motivate this investigation :
Model of the game resource archive format
This is a very common layout for such formats : there is a file header, a sequence of resource blocks, and a trailing index which describes the locations and types of the foregoing blocks.
What use is understanding the data structures ? In doing so, it becomes possible to write new utilities that disassemble the data into individual pieces, modify the necessary pieces, and then reassemble them into a form that the original game engine likes.
It’s important to take a careful, experimental approach to this since mistakes can be ruthlessly difficult to debug (unless you relish the thought of debugging the control flow through an opaque DOS executable). Thus, the very first goal in all of this is to create a program that can disassemble and reassemble the resource, thus creating an identical resource file. This diagram illustrates this complex initial process :
Rewriting the game resource file
So, yeah, this is one of the most complicated “copy file” operations that I can possibly code. But it forms an important basis, since the next step is to carefully replace one piece at a time.
Modifying a specific game resource
This diagram shows a simplistic model of a resource block that contains a series of message strings. The header contains pointers to each of the strings within the block. Instead of copying this particular resource block directly to the new file, a proposed modification utility will intercept it and rewrite the entire thing, writing new strings of arbitrary length and creating an adjusted header which will correctly point to the start of each new string. Thus, translated strings can be longer than the original strings.
Further Work
Exploiting this same approach, we can intercept and modify other game resources including fonts, images, and anything else that might need to be translated. I will explore specific examples in a later blog post.Followup
- Translating Return to Ringworld, in which I apply the ideas expressed in this post.
-
AE per frame rendering FFMPEG forming to video
9 février 2018, par Deckard CainI’m trying to setup an automated per frame rendering system using After Effects and FFMPEG. The idea here is that my slave nodes (running AE), will generate the frames and save them immediately to a Samba share (this way I can team multiple slaves together to tackle the same project file and we aren’t writing an 8GB AVI file, then compressing and deleting it when we could just render 300MB of frames and form it).
The database and Samba share are running on FreeBSD. This machine will then take those frames and use FFMPEG to combine them into an MP4 video.
The issue that I’m running into, is that when I render out the After Effects project file directly to an AVI file (one slave, no individual frame rendering), the video length is 1:31. When I render out the exact same project file into individual frames, then run it through FFMPEG to combine and compress them, the output is 1:49.
I have tried a billion different things to make the length of the video the same, but can’t seem to make it so :/
aerender.exe -mp -project %PROJECTFILE% -comp %COMPOSITION% -output [########].jpg
^Keep in mind, there may be 99999999 frames, or as little as 1 that needs to be rendered (if we need to re-render a specific section because of an asset change)
ffmpeg -nostdin -i %FRAMELOCATION% -c:v libx264 -preset veryfast -an -y outputVideo.mp4
-
Lossless trim and crop of MJPEG video
28 avril 2021, par prouastI am working on a project where I need to trim and crop MJPEG videos without any re-encoding. I have working code that accomplishes this by exporting the relevant frames as JPEGs, cropping them individually, and then joining them back together into an MJPEG.


However, this seems quite inefficient and slow. I am looking for pointers how to improve this approach. For example, would it be possible to store the JPEGs in-memory ?


import ffmpeg
import os
import shutil
import subprocess

def lossless_trim_and_crop(path, output_path, start, end, x, y, width, height, fps):
 # Trim the video in time and export all individual jpeg with ffmpeg + mjpeg2jpeg
 jpeg_folder = os.path.splitext(output_path)[0]
 jpeg_path = os.path.join(jpeg_folder, "frame_%03d.jpg")
 stream = ffmpeg.input(path, ss=start/fps, t=(end-start)/fps)
 stream = ffmpeg.output(stream, jpeg_path, vcodec='copy', **{'bsf:v': 'mjpeg2jpeg'})
 stream.run(quiet=True)
 # Crop all individual jpeg with jpegtran
 for filename in os.listdir(jpeg_folder):
 filepath = os.path.join(jpeg_folder, filename)
 out_filepath = os.path.splitext(filepath)[0] + "_c.jpg"
 subprocess.call(
 "jpegtran -perfect -crop {}x{}+{}+{} -outfile {} {}".format(
 width, height, x, y, out_filepath, filepath), shell=True)
 os.remove(filepath)
 # Join individual jpg back together
 cropped_jpeg_path = os.path.join(jpeg_folder, "frame_%03d_c.jpg")
 stream = ffmpeg.input(cropped_jpeg_path, framerate=fps)
 stream = ffmpeg.output(stream, output_path, vcodec='copy')
 stream.run(quiet=True)
 # Delete jpeg directory
 shutil.rmtree(jpeg_folder)