Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Recording video with unknown framerate with FFmpeg

    24 juillet 2017, par Chris

    I am recording video with FFmpeg and I would like the frame rate it is written with to at least be in the right ballpark. Right now I take the frame rate that my input claims to have and use that to set the frame rate (time_base) for my output video stream. However this is sometimes wildly different from the actual frame rate that I am getting (I have seen a stream claiming 50 fps but publishing at 9 fps).

    What I would like to do is use a elapsed timer and count the frames I record to calculate the actual frame rate I recorded at when I am finished recording. I would seem though that the frame rate is set in my AVStream is used in avcodec_open2 before I write any frames. If I set it later (such as while I am writing frames) while ffplay can play it (complaining that the time increment bits is 6 not 4) other video players cannot. Is there a way to set the frame rate for the whole file after writing the frames? If not is there a way to tell the frames themselves some sort of timestamp or frame rate while I am recording that will result in a valid recorded file?

  • FFMpeg Playlist with pipe for streaming [on hold]

    24 juillet 2017, par sword1st

    I'm trying to find a solution for stream multiple files without any connection breaks. I found this answer from KKetch :

    I managed to stream a static playlist of videos by using for each video a pipe (ex vid1.mp4 -> pipe1, vid2.mp4 -> pipe2 etc). Then i write into a single stream named pipe "stream" this way cat pipe1 pipe2 pipe3 > stream, and i use the stream pipe as input in FFMPEG to publish my stream.

    (I'm using windows. I don't know to use named pipes. I searched a lot but i couldn't do it. I can do it with vb.net if it's possible. But i don't know how:/ Sorry for my bad english)

    But i can't reply his message cuz i don't have enough reputation. I hope someone can help me how can i use pipes for input like playlist. Thanks!

  • FFMPEG RTMP streaming to FMS without stop ?

    24 juillet 2017, par Luis Mok

    I have some .mov files want to stream to Flash media server. i have already tried to stream a single .mov by FFMPEG command in terminal and it works, the FMS can display the thing i streaming in live.

    ffmpeg -re -i file1.mov -vcodec libx264 -f flv rtmp://localhost/livepkgr/livestream

    Now i want to stream multiple files, i tried to use above command one by one, but it seems Flash media server stop the streaming when file1 is finished, then start the stream with file2. It makes the stream player stopped when file1 is finish, and have to refresh the page in order to continue on file2.

    i am calling the FFMPEG command by a C program in linux, i wonder is there any method that i can prevent the FMS stopped when i switch the file source in FFMPEG? or is that possible to let FFMPEG constantly deliver the stream by multiple files source without stopped when a file finish?

  • Changing size video with ffmpeg, but output freezes

    24 juillet 2017, par Psykomusic

    I'm looking for a way to reduce the size of a video using FFmpeg. In fact my input file is an RTP real time stream 1024*720 MPEG2TS/h264 30fps. I want record 1 min. of this stream every time I want, but the size of the video is like 30 MB with this command:

    ffmpeg -y  -i rtp://192.168.1.3:5368 -c copy -t 60  toto.mp4
    

    I tried to reduce quality to reduce size with this command:

    ffmpeg -y  -i rtp://192.168.1.3:5368 -c:v libx264 -crf 23  toto.mp4
    

    and lot of other lines, I added options for bitrate -b:v 200k, framerate -r 5 and orthers...

    But every time I have the same problem, the video output freezes after 6 sec. Which option I have to use? Why my output is corrupted?

    EDIT: I think the freeze is because of the hardware of my embeded device. I use a gstreamer pipeline instead of the ffmpeg line .

    gst-launch-1.0 -e udpsrc port=5368 caps="application/x-rtp name=source ! queue ! rtpmp2tdepay ! aiurdemux streaming_latency=400 name=d d. ! queue ! vpudec ! decodebin ! videorate ! "video/x-raw,framerate=5/1" ! vpuenc_h264  bitrate=0 ! flvmux ! filesink location=toto.flv
    
  • How to apply multiple filters and inputs with ffmpeg

    24 juillet 2017, par Jason

    Not only do I have multiple filters, I have multiple inputs that I want to overlay. I usually have to them in 2-3 steps and wonder how to do it all in one command as it should be the most efficient way?

    1 and 2 literally identical. For readability, I've cut out the actual filters which are very long and complicated.

    1. image slide in left onto video
    2. Take output of 1, image slide in right
    3. Take output 2, textbox image fade in
    4. Take output3, text fade in (finish)

      1)
      ffmpeg -i input.mp4 -loop 1 -i image.jpg -filter_complex \
            "[1]scale=640:-1[i0]; \
             [i0]drawbox=color=white:t=15[i1]; \
             [i1]format=,fade=[i2]; \
             [i2]rotate=[i3]; \
             [0][i3]overlay= \
      -c:v libx264 -vb 10M output1.mp4
      
      2)
      ffmpeg -i output1.mp4 -loop 1 -i image2.jpg -filter_complex \
            "[1]scale=[i0]; \
             [i0]drawbox=[i1]; \
             [i1]format=,fade=[i2]; \
             [i2]rotate=[i3]; \
             [0][i3]overlay=" \
      -c:v libx264 -vb 10M output2.mp4
      
      3)
      ffmpeg -i output2.mp4 -i image3.jpg -filter_complex \
            "[1]scale=1080:-1 [ovrl], \
             [ovrl]format=fade=[i]; \
             [0][i]overlay=" \
      -c:v libx264 -vb 10M output4.mp4
      
      
      4)
      ffmpeg -i output4.mp4 -filter_complex "drawtext=" -vb 10M finaloutput.mp4