
Recherche avancée
Médias (16)
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (89)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains 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, parLa 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 2013Puis-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 vekariyaI'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 = 'Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug/';
 mainPath = mainPath.substring(0, mainPath.lastIndexOf("/"));
 
 Directory directoryExe3 = Directory("$mainPath");
 var dbPath = path.join(directoryExe3.path,
 "App.framework/Resources/flutter_assets/assets/ffmpeg/ffmpegmacos");
//here in "Products/Debug/" folder desktop app will generate

//directoryExe3 path will be, Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug

//and dbPath will be, Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug/App.framework/Resources/flutter_assets/assets/ffmpeg/ffmpegmacos

//so when app will run it can access it from this path

//executable code, command for ffmpeg

String transpose_str += "crop=" +
 out_w.toInt().toString() +
 ":" +
 out_h.toInt().toString() +
 ":" +
 x!.toInt().toString() +
 ":" +
 y!.toInt().toString() +
 ",";
 transpose_str += "scale=960:192";

Future<processresult> result_ = Process.run(dbPath, [
 "-ss",
 timestamp,
 "-i",
 inputFilePath,
 "-t",
 endTime,
 "-vf",
 transpose_str,
 "-an",
 "./temp.mp4",
 ]); 
</processresult>


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.


Any help would be appreciate !


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


-
Hit noise when playing part of wave file with ALSA PCM interface
11 décembre 2024, par wangt13I am working a WAVE file playing with ALSA PCM interface in Linux, and I heard noise when I played the file quickly and partially.


Here is my playing function.


static int playback_function(uint8_t *pcm_buf, int pcm_frames)
{
 int rc;
 uint8_t *buf;
 int frame_size, sent;
 int periodsize;
 int left;

 frame_size = chan * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16);
 periodsize = sys_periodsize; // 320 in my system
 buf = pcm_buf;
 left = pcm_frames;
 sent = 0;

 while (left > 0) {
 sent = (left > periodsize) ? periodsize : left;
 rc = snd_pcm_writei(pcm_handle, buf, sent);
 printf("rc: %d, sent: %d\n", rc, sent);
 if (rc == -EAGAIN || (rc >= 0 && (size_t)rc < sent)) {
 snd_pcm_wait(pcm_handle, 10);
 } else if (rc == -EPIPE) {
 snd_pcm_recover(pcm_handle, rc, 0);
 } else if (rc < 0) {
 break;
 }
 if (rc > 0) {
 left -= rc;
 buf += rc * frame_size;
 }
 }
 return rc;
}



The
pcm_buf
andpcm_frames
are got fromswr_convert()
inlibswresample
, in my case, thepcm_frames
is 1187.

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

rc: 320, sent: 320
rc: 87, sent: 87
rc: 320, sent: 320
rc: 320, sent: 320
rc: 103, sent: 103
rc: 320, sent: 320
rc: 320, sent: 320
rc: 103, sent: 103
rc: 320, sent: 320
rc: 320, sent: 320
rc: 103, sent: 103
rc: 320, sent: 320
rc: 320, sent: 320
rc: 103, sent: 103
rc: 320, sent: 320
rc: 320, sent: 320
rc: 103, sent: 103
rc: 320, sent: 320
rc: 320, sent: 320
rc: 103, sent: 103
rc: 320, sent: 320
rc: 320, sent: 320
rc: 103, sent: 103
rc: 320, sent: 320
rc: 320, sent: 320
rc: 103, sent: 103
rc: 320, sent: 320
rc: 320, sent: 320
rc: 87, sent: 87
rc: 320, sent: 320
rc: 320, sent: 320
rc: 103, sent: 103



With above function, sometimes I can hear noise when playing the WAVE file quickly and repeatly.

So, how can I improve the WAVE playing without the noise ??

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

static int playback_test(uint8_t *pcm_buf, int pcm_frames)
{
 uint8_t *buf;
 int trd;
 int rc;
 int left;
 int frame_size, sent;
 int periodsize;
 int aligned = 0;

 frame_size = chan * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16);
 periodsize = sys_periodsize; // 320 in my system

 buf = pcm_buf;
 left = pcm_frames;
 aligned = (left/periodsize + 1) * periodsize;
 memset(buf + left * frame_size, 0, (aligned - left) * frame_size);
 sent = 0;
///left = periodsize; // <== This causes more noise!!

 while (left > 0) {
 sent = (left > periodsize) ? periodsize : left;
 rc = snd_pcm_writei(pcm_handle, buf, sent);
 printf("rc: %d, sent: %d\n", rc, sent);
 if (rc == -EAGAIN || (rc >= 0 && (size_t)rc < sent)) {
 snd_pcm_wait(pcm_handle, 10);
 } else if (rc == -EPIPE) {
 snd_pcm_recover(pcm_handle, rc, 0);
 } else if (rc < 0) {
 break;
 }
 if (rc > 0) {
 left -= rc;
 buf += rc * frame_size;
 }
 }
 return rc;
}



There is NO improvement as of the noise.


-
Freeze when writing ffmpeg execution result to io.Pipe
7 novembre 2023, par alexI am writing a wrapper to work with
exec.Cmd
to work withio.Pipe
. The wrapper is intended to simplify work with the file system, I want to convert a video, write the result of the conversion toio.Pipe
, read it in the goroutine and transfer it to make a preview of the new converted file. For this purpose I useFFmpeg
. 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.

CmdRunner source code


type CmdRunner struct {
 commander Commander
 StdIn io.ReadCloser
 StdoutWriter io.WriteCloser
 StdErrWriter io.Writer
}

func (c *CmdRunner) RunByPipe(ctx context.Context) error {
 //done := make(chan error)
 name, args := c.commander.Command()
 cmd := exec.CommandContext(ctx, name, args...)

 if c.StdIn != nil {
 fmt.Print("RunByPipe STDIN\n")
 cmd.Stdin = c.StdIn
 }

 if c.StdoutWriter != nil {
 fmt.Print("RunByPipe STDOUT\n")
 cmd.Stdout = c.StdoutWriter
 }

 stderr := bytes.Buffer{}
 cmd.Stderr = &stderr

 if err := cmd.Start(); err != nil {
 return err
 }

 if err := cmd.Wait(); err != nil {
 return err
 }

 if stderr.String() != "" {
 return fmt.Errorf("want empty stderr, but got %s", stderr.String())
 }

 return nil
}




Unit test code


type TestCommander struct {
 name string
 args []string
}

func (c *TestCommander) SetCommand(name string, args []string) {
 c.name = name
 c.args = args
}

func (c *TestCommander) Command() (string, []string) {
 return c.name, c.args
}

func TestConvert(t *testing.T) {
 ctx := context.Background()
 filePath := "testdata/input_mp4.mp4"
 data, err := convertFile(filePath, ctx)
 outFile := "testdata/output_mp4.mp4"
 if err != nil {
 fmt.Print("ERR: ", err, "\n")
 }

 os.WriteFile(outFile, data, 0644)

}

func convertFile(filePath string, ctx context.Context) (bytes []byte, err error) {
 // Create a CmdRunner instance with your custom Commander.
 runner := &CmdRunner{}
 commander := &TestCommander{}
 args := []string{
 "-nostats",
 "-i", filePath,
 "-y",
 "-loglevel", "0",
 "-filter:v", "fps=30, crop=trunc(iw/2)*2:trunc(ih/2)*2",
 "-c:v", "libx264",
 "-c:a", "aac",
 "-pix_fmt", "yuv420p",
 "-movflags", "frag_keyframe+faststart",
 "-bufsize", "24M",
 "-maxrate", "12M",
 "-f", "mp4",
 "pipe:1",
 }

 commander.SetCommand("ffmpeg", args)
 runner.SetCommander(commander)
 outputPipeReader, outputPipeWriter := io.Pipe()
 runner.SetStdOutWriter(outputPipeWriter)

 wg := &sync.WaitGroup{}
 wg.Add(1)
 go func() {
 defer outputPipeReader.Close()
 defer wg.Done()

 // Read data from output pipe
 bytes, err = io.ReadAll(outputPipeReader)
 if err != nil {
 fmt.Print("\nReadAll err: ", err, "\n")
 }
 }()

 err = runner.RunByPipe(ctx)
 if err != nil {
 fmt.Print("\nRunByPipe err: ", err, "\n")
 return
 }

 wg.Wait()

 return
}



I can't find a clue as to what might have gone wrong.
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 toio.Pipe
.Why ?