
Recherche avancée
Autres articles (58)
-
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
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 -
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 (...)
Sur d’autres sites (8778)
-
FFMPEG Command to convert images to svg [closed]
5 mai 2024, par themujahidkhanUsers are trying to convert images to SVG image on my website, Below I've given a link to the site, more detail on error and code that handles the conversion of media files.


You can check out the live site Here.


Steps to reproduce the error.


- 

- Upload the png file,
- Select SVG as output file
- Click convert.








It is throwing error.


Below is the code for that converts users input and gives input based on user preference.


// imports

import { createCanvas, loadImage } from "canvas";

import { Action } from "@/types";
import { FFmpeg } from "@ffmpeg/ffmpeg";
import { fetchFile } from "@ffmpeg/util";

function getFileExtension(file_name: string) {
 const regex = /(?:\.([^.]+))?$/; // Matches the last dot and everything after it
 const match = regex.exec(file_name);
 if (match && match[1]) {
 return match[1];
 }
 return ""; // No file extension found
}

function removeFileExtension(file_name: string) {
 const lastDotIndex = file_name.lastIndexOf(".");
 if (lastDotIndex !== -1) {
 return file_name.slice(0, lastDotIndex);
 }
 return file_name; // No file extension found
}

export default async function convert(
 ffmpeg: FFmpeg,
 action: Action
): Promise<any> {
 const { file, to, file_name, file_type } = action;
 const input = getFileExtension(file_name);
 const output = removeFileExtension(file_name) + "." + to;
 ffmpeg.writeFile(input, await fetchFile(file));

 // FFMPEG COMMANDS
 let ffmpeg_cmd: any = [];

 if (to === "svg") {
 ffmpeg_cmd = [
 "-i",
 input,
 "-vf",
 "scale=trunc(iw/2)*2:trunc(ih/2)*2",
 "-c:v",
 "libvpx-vp9",
 "-crf",
 "30",
 "-b:v",
 "1M",
 "-c:a",
 "libopus",
 "-b:a",
 "128k",
 output,
 ];
 } else if (to === "3gp") {
 ffmpeg_cmd = [
 "-i",
 input,
 "-r",
 "20",
 "-s",
 "352x288",
 "-vb",
 "400k",
 "-acodec",
 "aac",
 "-strict",
 "experimental",
 "-ac",
 "1",
 "-ar",
 "8000",
 "-ab",
 "24k",
 output,
 ];
 } else {
 ffmpeg_cmd = ["-i", input, output];
 }

 // execute cmd
 await ffmpeg.exec(ffmpeg_cmd);

 const data = (await ffmpeg.readFile(output)) as any;
 const blob = new Blob([data], { type: file_type.split("/")[0] });
 const url = URL.createObjectURL(blob);
 return { url, output };
}

</any>


Help appreciated, Thank You


-
How to quit pexpect launched ffmpeg with key q pressed
25 février 2014, par Shumani used pexpect to call ffmpeg which is a lengthy process. it took half an hour, how can i detect user has pressed q key to stop it ? just like when you press q when using ffmpeg command line tool
the ffmpeg command line is
ffmpeg -y -i url -c copy -absf aac_adtstoasc out.mp4
the last line of ffmpeg output is
...
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Stream #0:2 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 84 fps= 77 q=-1.0 Lsize= 184626kB time=00:00:06.96 bitrate=217120.3kbits/sthe code i have now is
reo = re.compile("""\S+\s+(?P\d+) # frame
\s\S+\s+(?P<fps>\d+) # fps
\sq=(?P<q>\S+) # q
\s\S+\s+(?P<size>\S+) # size
\stime=(?P<time>\S+) # time
\sbitrate=(?P<bitrate>[\d\.]+) # bitrate
""", re.X)
durationReo = ('(?<=Duration:\s)\S+(?=,)')
cpl = thread.compile_pattern_list([
pexpect.EOF,
reo,
durationReo
])
while True:
i = thread.expect_list(cpl, timeout=None)
if i == 0: # EOF
print "the sub process exited"
break
elif i == 1:
frame_number = thread.match.group(0)
print frame_number
print reo.search(frame_number).groups()
# thread.close
elif i == 2:
durationLine = thread.match.group(0)
print 'Duration:', durationLine
# print "something :",thread.match.group(1)
pass
</bitrate></time></size></q></fps>with this code i can already get the frame info and duration info, the ultimate goal is to create a textual progress bar with another python progressbar module. but with the ability to send the 'q' pressed signal to ffmpeg child process.
-
Detecting the value scale of statistics returned from ffprobe
15 septembre 2023, par FarskiI'm using
ffprobe
to detect max and min levels for various audio files. An example of the command I'm using is :

ffprobe -v error -f lavfi -i amovie=my_song.mp3,asetnsamples=n=4410,astats=metadata=1:reset=1 -show_entries frame_tags=lavfi.astats.Overall.Max_level,lavfi.astats.Overall.Min_level -of json


The max/min level values returned use different scales, depending on the format of the input file.


For example, an MP3 file may return fractional values from
-1.0
to1.0
representing a percent of maximum level. A signed 16 bit WAV file returns values in the range-32,768
to32767
. A signed 32 bit FLAC file uses the range-2,147,483,648
to2,147,483,647
. In these cases, the bit size of the values matches the bit depth of the audio file.

In other cases, such as a signed 8 bit WAV file, the results are returned using a scale that does not match the input file, such as 16 bit scale (
-32,768
to32767
).

I'm trying to determine if there's anyway to detect which format or scale
ffprobe
is using when the results are returned, besides trying to do it heuristically. I haven't been able to find any other value that gets returned which specifically reflects the number system being used to generate these levels values.sample_fmt
does, in some cases, match, but in cases such as a s8 WAV file,sample_fmt
would returns8
, which does not match the number format of the returned levels values (s16).

If it's not possible to request this information from
ffprobe
JIT, is there anywhere in the code base that would describe how it determines which scale to use ?