Recherche avancée

Médias (1)

Mot : - Tags -/punk

Autres articles (57)

  • L’espace de configuration de MediaSPIP

    29 novembre 2010, par

    L’espace de configuration de MediaSPIP est réservé aux administrateurs. Un lien de menu "administrer" est généralement affiché en haut de la page [1].
    Il permet de configurer finement votre site.
    La navigation de cet espace de configuration est divisé en trois parties : la configuration générale du site qui permet notamment de modifier : les informations principales concernant le site (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

Sur d’autres sites (8802)

  • Different ffmpeg result after saving to png

    28 juillet 2023, par Kalev Maricq

    Saving images to PNG first seems to produce different ffmpeg encodes. Running this test code

    


    from PIL import Image
import cv2
import ffmpeg
import hashlib

ffmpeg.input('test.jpg').output('testff.png').run()
cv2.imwrite('testcv.png',cv2.imread('test.jpg'))
Image.open('test.jpg').save('testpil.png')

hashes=[]
for suf in ['.jpg','ff.png','cv.png','pil.png']:
    dest='test'+suf.replace('.','')+'.mp4'
    ffmpeg.input('test'+suf).output(dest).run()
    hashes.append(hashlib.file_digest(open(dest,'rb'),'md5').hexdigest())
    
print(hashes)


    


    I get
    
['a5b744a8ac0f6de9ec4de43ff737c46e'
    
,'ab62474f2160899e064ba24890047372'
    
,'baa788d5e4ef212ab610b8b5cf7772cb'
    
,'baa788d5e4ef212ab610b8b5cf7772cb']

    


    As you can see, the only two that match are the cv2 and pillow conversions, and none of them match the original. In terms of file size, the results that passed to png first seem to be about 10% smaller than the direct-from-jpg result.

    


    Why is this happening and how can I avoid changing image data until I'm ready to encode ?

    


  • FFMPEG Command to convert images to svg [closed]

    5 mai 2024, par themujahidkhan

    Users 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.

    


      

    1. Upload the png file,
    2. 


    3. Select SVG as output file
    4. 


    5. Click convert.
    6. 


    


    It is throwing error.

    


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

    


    // imports&#xA;&#xA;import { createCanvas, loadImage } from "canvas";&#xA;&#xA;import { Action } from "@/types";&#xA;import { FFmpeg } from "@ffmpeg/ffmpeg";&#xA;import { fetchFile } from "@ffmpeg/util";&#xA;&#xA;function getFileExtension(file_name: string) {&#xA;  const regex = /(?:\.([^.]&#x2B;))?$/; // Matches the last dot and everything after it&#xA;  const match = regex.exec(file_name);&#xA;  if (match &amp;&amp; match[1]) {&#xA;    return match[1];&#xA;  }&#xA;  return ""; // No file extension found&#xA;}&#xA;&#xA;function removeFileExtension(file_name: string) {&#xA;  const lastDotIndex = file_name.lastIndexOf(".");&#xA;  if (lastDotIndex !== -1) {&#xA;    return file_name.slice(0, lastDotIndex);&#xA;  }&#xA;  return file_name; // No file extension found&#xA;}&#xA;&#xA;export default async function convert(&#xA;  ffmpeg: FFmpeg,&#xA;  action: Action&#xA;): Promise<any> {&#xA;  const { file, to, file_name, file_type } = action;&#xA;  const input = getFileExtension(file_name);&#xA;  const output = removeFileExtension(file_name) &#x2B; "." &#x2B; to;&#xA;  ffmpeg.writeFile(input, await fetchFile(file));&#xA;&#xA;  // FFMPEG COMMANDS&#xA;  let ffmpeg_cmd: any = [];&#xA;&#xA;  if (to === "svg") {&#xA;    ffmpeg_cmd = [&#xA;      "-i",&#xA;      input,&#xA;      "-vf",&#xA;      "scale=trunc(iw/2)*2:trunc(ih/2)*2",&#xA;      "-c:v",&#xA;      "libvpx-vp9",&#xA;      "-crf",&#xA;      "30",&#xA;      "-b:v",&#xA;      "1M",&#xA;      "-c:a",&#xA;      "libopus",&#xA;      "-b:a",&#xA;      "128k",&#xA;      output,&#xA;    ];&#xA;  } else if (to === "3gp") {&#xA;    ffmpeg_cmd = [&#xA;      "-i",&#xA;      input,&#xA;      "-r",&#xA;      "20",&#xA;      "-s",&#xA;      "352x288",&#xA;      "-vb",&#xA;      "400k",&#xA;      "-acodec",&#xA;      "aac",&#xA;      "-strict",&#xA;      "experimental",&#xA;      "-ac",&#xA;      "1",&#xA;      "-ar",&#xA;      "8000",&#xA;      "-ab",&#xA;      "24k",&#xA;      output,&#xA;    ];&#xA;  } else {&#xA;    ffmpeg_cmd = ["-i", input, output];&#xA;  }&#xA;&#xA;  // execute cmd&#xA;  await ffmpeg.exec(ffmpeg_cmd);&#xA;&#xA;  const data = (await ffmpeg.readFile(output)) as any;&#xA;  const blob = new Blob([data], { type: file_type.split("/")[0] });&#xA;  const url = URL.createObjectURL(blob);&#xA;  return { url, output };&#xA;}&#xA;&#xA;</any>

    &#xA;

    Help appreciated, Thank You

    &#xA;

  • How to quit pexpect launched ffmpeg with key q pressed

    25 février 2014, par Shuman

    i 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/s

    the 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 = (&#39;(?&lt;=Duration:\s)\S+(?=,)&#39;)

    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 &#39;Duration:&#39;, 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.