Recherche avancée

Médias (0)

Mot : - Tags -/interaction

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (108)

Sur d’autres sites (15686)

  • Add an image behind a video file (.mp4) in python

    12 avril 2020, par George Lua

    I am attempting to add an image behind a video using moviepy and cannot come up with any way to do it. My image dimension is (1080 x 720) and my video dimension is (200 x 200). I am trying to put the video file on top of the image file, place it in the midlle and export the final video with the dimensions of the image. This is a visual representation of what I am trying to achieve :

    



    View image

    



    I tried doing this with the following code, but could not manage to get it to work. Any help is seriously appreciated :)

    



    import moviepy
import moviepy.editor as mp

video = mp.VideoFileClip("/media/pi/vid.mp4")

logo = (mp.ImageClip("/media/pi/pic.png"))

# Preferably I would want the image to be the same duration as the video file. 
# The following was just for testing.
final = mp.CompositeVideoClip([video, logo.set_duration(3)])
final.write_videofile("test.mp4")


    


  • Got two working ffmpeg commands, help me transform them

    7 mars 2019, par lukistar

    here are two different commands.

    ffmpeg -i input.mp3 -i second.mp3 -filter_complex "[0:a]atrim=end=10,asetpts=N/SR/TB[begin];[0:a]atrim=start=10,asetpts=N/SR/TB[end];[begin][1:a][end]concat=n=3:v=0:a=1[a]" -map "[a]" output

    This command inserts second.mp3 into input.mp3. It seems to always keep the parameters of input.mp3. It inserts it in exact 10 seconds of input.mp3.

    Here is the second command :

    ffmpeg -i input.mp3 -i second.mp3 -filter_complex "[1:a]adelay=10000|10000[1a];[0:a][1a]amix=duration:first" output

    This command is closer to my final goal. It plays input.mp3 and in exact 10 seconds it plays along second.mp3 without stopping input.mp3’s sound.

    My final goal is to create final.mp3.

    Its duration must always equal input.mp3 duration. It must keep the samplerate, the count of channels, etc of input.mp3

    When playing final.mp3, it must play the whole input.mp3.
    But each 10-15 seconds, it must play second.mp3 without stopping input.mp3.
    It could be said that I must use "Second command" but in a loop.
    It would be great if there is one-line command for that in ffmpeg.
    I am working with flac, mp3 and wav and both of the commands, I got, work great for what they are doing.

    For example :

    input.mp3 could be 40 seconds long.

    second.mp3 could be 2 seconds long.

    When I play final.mp3 it will be 40 seconds long, but each 10-15 seconds(on random) it will play second.mp3 at the same time as input.mp3.

    Sadly I have no experience with ffmpeg, both of the commands I got are answers to questions here in stackoverflow. Hope somebody can help me. Thank you !

  • Flutter ffmpeg : Video merger not working

    17 septembre 2021, par Madhusri J

    I have been trying to merge two videofiles using ffmpeg in flutter but a single videofile is merging two times and the sound of video is not working

    


    This is my code

    


     final appDir = await getExternalStorageDirectory();
 String rawDocumentPath = appDir!.path;
 final outputPath = '$rawDocumentPath/videomerge.mp4';

 final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();

 String commandToExecute = '-y -i ${VideoFiles[0].path} -i ${VideoFiles[1].path} 
  -filter_complex \'[0:v][0:v]concat=n=2:v=1:a=0[out]\' -map \'[out]\' $outputPath';

 _flutterFFmpeg.execute(commandToExecute).then((rc) => print("FFmpeg process exited with 
 rc $rc"));


    


    Any help would be greatly appreciated :)