Recherche avancée

Médias (16)

Mot : - Tags -/mp3

Autres articles (89)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Mediabox : ouvrir les images dans l’espace maximal pour l’utilisateur

    8 février 2011, par

    La visualisation des images est restreinte par la largeur accordée par le design du site (dépendant du thème utilisé). Elles sont donc visibles sous un format réduit. Afin de profiter de l’ensemble de la place disponible sur l’écran de l’utilisateur, il est possible d’ajouter une fonctionnalité d’affichage de l’image dans une boite multimedia apparaissant au dessus du reste du contenu.
    Pour ce faire il est nécessaire d’installer le plugin "Mediabox".
    Configuration de la boite multimédia
    Dès (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (8154)

  • Flutter error in Ffmpeg, "Unhandled Exception : ProcessException : No such file or directory" in macOS desktop version

    19 avril 2024, par pratik vekariya

    I'm trying video trim video using ffmpeg, for macOS desktop application.

    


    I have downloaded ffmpeg from here for macOS.

    


    Here is my code

    


        String mainPath = &#x27;Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug/&#x27;;&#xA;        mainPath = mainPath.substring(0, mainPath.lastIndexOf("/"));&#xA;    &#xA;                  Directory directoryExe3 = Directory("$mainPath");&#xA;                  var dbPath = path.join(directoryExe3.path,&#xA;                      "App.framework/Resources/flutter_assets/assets/ffmpeg/ffmpegmacos");&#xA;//here in "Products/Debug/" folder desktop app will generate&#xA;&#xA;//directoryExe3 path will be, Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug&#xA;&#xA;//and dbPath will be, Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug/App.framework/Resources/flutter_assets/assets/ffmpeg/ffmpegmacos&#xA;&#xA;//so when app will run it can access it from this path&#xA;&#xA;//executable code, command for ffmpeg&#xA;&#xA;String transpose_str &#x2B;= "crop=" &#x2B;&#xA;              out_w.toInt().toString() &#x2B;&#xA;              ":" &#x2B;&#xA;              out_h.toInt().toString() &#x2B;&#xA;              ":" &#x2B;&#xA;              x!.toInt().toString() &#x2B;&#xA;              ":" &#x2B;&#xA;              y!.toInt().toString() &#x2B;&#xA;              ",";&#xA;          transpose_str &#x2B;= "scale=960:192";&#xA;&#xA;Future<processresult> result_ = Process.run(dbPath, [&#xA;                "-ss",&#xA;                timestamp,&#xA;                "-i",&#xA;                inputFilePath,&#xA;                "-t",&#xA;                endTime,&#xA;                "-vf",&#xA;                transpose_str,&#xA;                "-an",&#xA;                "./temp.mp4",&#xA;              ]); &#xA;</processresult>

    &#xA;

    Now when I run this in macOS desktop verison, it gives me error at Process.run that in dbPath, Unhandled Exception : ProcessException : No such file or directory.

    &#xA;

    Any help would be appreciate !

    &#xA;

    when i run this as desktop version it should get file from assets.

    &#xA;

  • Hit noise when playing part of wave file with ALSA PCM interface

    11 décembre 2024, par wangt13

    I am working a WAVE file playing with ALSA PCM interface in Linux, and I heard noise when I played the file quickly and partially.

    &#xA;

    Here is my playing function.

    &#xA;

    static int playback_function(uint8_t *pcm_buf, int pcm_frames)&#xA;{&#xA;    int  rc;&#xA;    uint8_t *buf;&#xA;    int frame_size, sent;&#xA;    int periodsize;&#xA;    int left;&#xA;&#xA;    frame_size = chan * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16);&#xA;    periodsize = sys_periodsize; // 320 in my system&#xA;    buf = pcm_buf;&#xA;    left = pcm_frames;&#xA;    sent = 0;&#xA;&#xA;    while (left > 0) {&#xA;        sent = (left > periodsize) ? periodsize : left;&#xA;        rc = snd_pcm_writei(pcm_handle, buf, sent);&#xA;        printf("rc: %d, sent: %d\n", rc, sent);&#xA;        if (rc == -EAGAIN || (rc >= 0 &amp;&amp; (size_t)rc &lt; sent)) {&#xA;            snd_pcm_wait(pcm_handle, 10);&#xA;        } else if (rc == -EPIPE) {&#xA;            snd_pcm_recover(pcm_handle, rc, 0);&#xA;        } else if (rc &lt; 0) {&#xA;            break;&#xA;        }&#xA;        if (rc > 0) {&#xA;            left -= rc;&#xA;            buf &#x2B;= rc * frame_size;&#xA;        }&#xA;    }&#xA;    return rc;&#xA;}&#xA;

    &#xA;

    The pcm_buf and pcm_frames are got from swr_convert() in libswresample, in my case, the pcm_frames is 1187.

    &#xA;

    By adding printf("rc: %d, sent: %d\n", rc, sent);, I got following logs.

    &#xA;

    rc: 320, sent: 320&#xA;rc: 87, sent: 87&#xA;rc: 320, sent: 320&#xA;rc: 320, sent: 320&#xA;rc: 103, sent: 103&#xA;rc: 320, sent: 320&#xA;rc: 320, sent: 320&#xA;rc: 103, sent: 103&#xA;rc: 320, sent: 320&#xA;rc: 320, sent: 320&#xA;rc: 103, sent: 103&#xA;rc: 320, sent: 320&#xA;rc: 320, sent: 320&#xA;rc: 103, sent: 103&#xA;rc: 320, sent: 320&#xA;rc: 320, sent: 320&#xA;rc: 103, sent: 103&#xA;rc: 320, sent: 320&#xA;rc: 320, sent: 320&#xA;rc: 103, sent: 103&#xA;rc: 320, sent: 320&#xA;rc: 320, sent: 320&#xA;rc: 103, sent: 103&#xA;rc: 320, sent: 320&#xA;rc: 320, sent: 320&#xA;rc: 103, sent: 103&#xA;rc: 320, sent: 320&#xA;rc: 320, sent: 320&#xA;rc: 87, sent: 87&#xA;rc: 320, sent: 320&#xA;rc: 320, sent: 320&#xA;rc: 103, sent: 103&#xA;

    &#xA;

    With above function, sometimes I can hear noise when playing the WAVE file quickly and repeatly.
    &#xA;So, how can I improve the WAVE playing without the noise ??

    &#xA;

    I changed the above function by using filling 0 to the end of data buffer (to enforce silence).

    &#xA;

    static int playback_test(uint8_t *pcm_buf, int pcm_frames)&#xA;{&#xA;    uint8_t *buf;&#xA;    int trd;&#xA;    int rc;&#xA;    int left;&#xA;    int frame_size, sent;&#xA;    int periodsize;&#xA;    int aligned = 0;&#xA;&#xA;    frame_size = chan * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16);&#xA;    periodsize = sys_periodsize; // 320 in my system&#xA;&#xA;    buf = pcm_buf;&#xA;    left = pcm_frames;&#xA;    aligned = (left/periodsize &#x2B; 1) * periodsize;&#xA;    memset(buf &#x2B; left * frame_size, 0, (aligned - left) * frame_size);&#xA;    sent = 0;&#xA;///left = periodsize; // &lt;== This causes more noise!!&#xA;&#xA;    while (left > 0) {&#xA;        sent = (left > periodsize) ? periodsize : left;&#xA;        rc = snd_pcm_writei(pcm_handle, buf, sent);&#xA;        printf("rc: %d, sent: %d\n", rc, sent);&#xA;        if (rc == -EAGAIN || (rc >= 0 &amp;&amp; (size_t)rc &lt; sent)) {&#xA;            snd_pcm_wait(pcm_handle, 10);&#xA;        } else if (rc == -EPIPE) {&#xA;            snd_pcm_recover(pcm_handle, rc, 0);&#xA;        } else if (rc &lt; 0) {&#xA;            break;&#xA;        }&#xA;        if (rc > 0) {&#xA;            left -= rc;&#xA;            buf &#x2B;= rc * frame_size;&#xA;        }&#xA;    }&#xA;    return rc;&#xA;}&#xA;

    &#xA;

    There is NO improvement as of the noise.

    &#xA;

  • Freeze when writing ffmpeg execution result to io.Pipe

    7 novembre 2023, par alex

    I am writing a wrapper to work with exec.Cmd to work with io.Pipe. The wrapper is intended to simplify work with the file system, I want to convert a video, write the result of the conversion to io.Pipe, read it in the goroutine and transfer it to make a preview of the new converted file. For this purpose I use FFmpeg. But I've encountered a problem, when I start the test the execution just hangs and I can't get any result, but there are no errors, everything just hangs.

    &#xA;

    CmdRunner source code

    &#xA;

    type CmdRunner struct {&#xA;    commander Commander&#xA;    StdIn io.ReadCloser&#xA;    StdoutWriter io.WriteCloser&#xA;    StdErrWriter io.Writer&#xA;}&#xA;&#xA;func (c *CmdRunner) RunByPipe(ctx context.Context) error {&#xA;    //done := make(chan error)&#xA;    name, args := c.commander.Command()&#xA;    cmd := exec.CommandContext(ctx, name, args...)&#xA;&#xA;    if c.StdIn != nil {&#xA;        fmt.Print("RunByPipe STDIN\n")&#xA;        cmd.Stdin = c.StdIn&#xA;    }&#xA;&#xA;    if c.StdoutWriter != nil {&#xA;        fmt.Print("RunByPipe STDOUT\n")&#xA;        cmd.Stdout = c.StdoutWriter&#xA;    }&#xA;&#xA;    stderr := bytes.Buffer{}&#xA;    cmd.Stderr = &amp;stderr&#xA;&#xA;    if err := cmd.Start(); err != nil {&#xA;        return err&#xA;    }&#xA;&#xA;    if err := cmd.Wait(); err != nil {&#xA;        return err&#xA;    }&#xA;&#xA;    if stderr.String() != "" {&#xA;        return fmt.Errorf("want empty stderr, but got %s", stderr.String())&#xA;    }&#xA;&#xA;    return nil&#xA;}&#xA;&#xA;

    &#xA;

    Unit test code

    &#xA;

    type TestCommander struct {&#xA;    name string&#xA;    args []string&#xA;}&#xA;&#xA;func (c *TestCommander) SetCommand(name string, args []string) {&#xA;    c.name = name&#xA;    c.args = args&#xA;}&#xA;&#xA;func (c *TestCommander) Command() (string, []string) {&#xA;    return c.name, c.args&#xA;}&#xA;&#xA;func TestConvert(t *testing.T) {&#xA;    ctx := context.Background()&#xA;    filePath := "testdata/input_mp4.mp4"&#xA;    data, err := convertFile(filePath, ctx)&#xA;    outFile := "testdata/output_mp4.mp4"&#xA;    if err != nil {&#xA;        fmt.Print("ERR: ", err, "\n")&#xA;    }&#xA;&#xA;    os.WriteFile(outFile, data, 0644)&#xA;&#xA;}&#xA;&#xA;func convertFile(filePath string, ctx context.Context) (bytes []byte, err error) {&#xA;    // Create a CmdRunner instance with your custom Commander.&#xA;    runner := &amp;CmdRunner{}&#xA;    commander := &amp;TestCommander{}&#xA;    args := []string{&#xA;        "-nostats",&#xA;        "-i", filePath,&#xA;        "-y",&#xA;        "-loglevel", "0",&#xA;        "-filter:v", "fps=30, crop=trunc(iw/2)*2:trunc(ih/2)*2",&#xA;        "-c:v", "libx264",&#xA;        "-c:a", "aac",&#xA;        "-pix_fmt", "yuv420p",&#xA;        "-movflags", "frag_keyframe&#x2B;faststart",&#xA;        "-bufsize", "24M",&#xA;        "-maxrate", "12M",&#xA;        "-f", "mp4",&#xA;        "pipe:1",&#xA;    }&#xA;&#xA;    commander.SetCommand("ffmpeg", args)&#xA;    runner.SetCommander(commander)&#xA;    outputPipeReader, outputPipeWriter := io.Pipe()&#xA;    runner.SetStdOutWriter(outputPipeWriter)&#xA;&#xA;    wg := &amp;sync.WaitGroup{}&#xA;    wg.Add(1)&#xA;    go func() {&#xA;        defer outputPipeReader.Close()&#xA;        defer wg.Done()&#xA;&#xA;        // Read data from output pipe&#xA;        bytes, err = io.ReadAll(outputPipeReader)&#xA;        if err != nil {&#xA;            fmt.Print("\nReadAll err: ", err, "\n")&#xA;        }&#xA;    }()&#xA;&#xA;    err = runner.RunByPipe(ctx)&#xA;    if err != nil {&#xA;        fmt.Print("\nRunByPipe err: ", err, "\n")&#xA;        return&#xA;    }&#xA;&#xA;    wg.Wait()&#xA;&#xA;    return&#xA;}&#xA;

    &#xA;

    I can't find a clue as to what might have gone wrong.&#xA;P.S : But if I remove if err := cmd.Wait(); err != nil { return err } Then the problem goes away, but there will be no data, because nothing is written to io.Pipe.Why ?

    &#xA;