Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • combine two -filter_complex command together

    9 juillet 2017, par Xi Xiao

    Below, I have two ffmpeg commands (1, 2) to be combined into (3).

    1. add sounds from 1.mp3 and 1.3gp into muted 1.mp4

    code works without error:

    ffmpeg -i 1.mp3 -i 1.3gp -i 1.mp4 \
      -filter_complex "[1]adelay=640|640[s1];[0][s1]amix=2[mixout];" \
      -map 2:v -map [mixout] -c:v copy result.mp4 
    
    1. add watermark to top-right of 1.mp4

    code works without error:

    ffmpeg -i 1.mp4 -i logo.png \
      -filter_complex "overlay=x=main_w-overlay_w:y=1" \
       result.mp4
    
    1. combine above two commands into one

    My code fails

    ffmpeg -i 1.mp3 -i 1.3gp -i 1.mp4 -i logo.png \
      -filter_complex "[1]adelay=640|640[s1];[0][s1]amix=2[mixout];[2:v][3]overlay=x=main_w-overlay_w:y=1[outv]" \
      -map [outv] -map [mixout] -c:v copy result.mp4
    

    What am I doing wrong here?

  • ffmpeg video duration not true

    9 juillet 2017, par MOHAMMAD BALADI

    i have a problem with ffmpeg in php i need export a trailer from uploaded video in php,and for it try this cod:

    exec( "ffmpeg -i $vidpath -vf select='lt(mod(t,60),5)',setpts=N/FRAME_RATE/TB -af aselect='lt(mod(t,60),5)',asetpts=N/SR/TB  $trailer 2>&1")
    

    this code generate trailer from video as every 60 second 5 second but trailer file duration is equal original file! for example if target video time is 4:00 minutes, trailer file time will be 4:00 minutes but only show 20 seconds video! can every body help me? thanx

  • Nginx Live transcoding with ffmpeg

    9 juillet 2017, par Stian Tofte

    I'm live streaming video to my server(It's external somewhere in the world). And what I'm trying to do here, is that my server will transcode the input to a lower bitrate before it pushes it to the video site like twitch and so on.

    And I'm doing this on windows. I have tried to google around watched youtube videos. and so on.. But couldn't find any solution for it. So here is what I have at this moment(not working).

    In my nginx.conf:

    rtmp {
    server {
        listen 1935;
        chunk_size 8192;
    
        application code {
            live on;
    
        }
    
        application twitch {
            push rtmp://live-ams.twitch.tv/app/live_xxxxxxxxxxxxxxxxx;
        }
    }
    

    So here the application code is receving the stream from my computer at home. I'm using ffmpeg to transcode it.

    And here is my batch file(That I have to start manualy. Can't start it within the config of nginx on windows.)

    ffmpeg -i rtmp://localhost/code -vcodec flv -acodec copy -s 1280x720 -f flv rtmp://localhost/twitch
    pause
    

    Right now It's just downscaling but that is okay. So this is supposed to send the stream back to the "twitch" application in my nginx config. And then nginx will stream it to twitch.

    But when I launch my ffmpeg bat file.. I get this: enter image description here

    So it's here my road ends. Anyone knows how to do this?

    Thanks in advance :) Stian

  • ffmpeg called from python random failure

    9 juillet 2017, par Jim Weisbin

    Python 2.7.1 on Mac OS X 10.12.5, ffmpeg 3.3.2 (installed with Brew).

    ffmpeg is called in a loop though thousands of Apple Lossless files, converting to mp3 and tagging.

    thecall = '/usr/local/bin/ffmpeg -hide_banner -loglevel error -i ' +  + ' -i ' +  + ' -map 0:0 -map 1:0 -id3v2_version 3 -map_metadata -1 -metadata album="xxx" -metadata artist="xxx" -metadata comment="Cover (Front)" -f mp3 -b:a 128K ' + '
    

    os.system(thecall)

    this works perfectly from the command line, and also works from Python most of the time, but randomly fails with the message

    [alac @ 0x7fc888858800] invalid samples per frame: 0 Error while decoding stream #0:0: Invalid data found when processing input

    What's strange is that on the files it failed on, if I run it from the command line it succeeds. I tried putting in time.sleep(5) but no change. And the failures are not always on the same file, so it seems like it's a memory or threading issue. I also tried calling with subprocess() instead, no change.

    Any help would be appreciated.

  • python with ffmpeg fails randomly

    8 juillet 2017, par Jim Weisbin

    Python 2.7.1 on Mac OS X 10.12.5, ffmpeg 3.3.2 (installed with Brew).

    I'm calling ffmpeg on a loop though thousands of Apple Lossless files, converting to mp3 and tagging as I go. Here's the call:

    thecall = '/usr/local/bin/ffmpeg -hide_banner -loglevel error -i ' +  + ' -i ' +  + ' -map 0:0 -map 1:0 -id3v2_version 3 -map_metadata -1 -metadata album="xxx" -metadata artist="xxx" -metadata comment="Cover (Front)" -f mp3 -b:a 128K ' + '
    
    os.system(thecall)
    

    this works perfectly from the command line, and also works from Python most of the time, but randomly fails with the message

    [alac @ 0x7fc888858800] invalid samples per frame: 0
    Error while decoding stream #0:0: Invalid data found when processing input
    

    What's strange is that on the files it failed on, if I run it from the command line it succeeds. I tried putting in time.sleep(5) but no change. And the failures are not always on the same file, so it seems like it's a memory or threading issue. I also tried calling with subprocess() instead, no change.

    Any help would be appreciated.