Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Add audio (with an offset) to video with FFMPEG

    5 novembre 2011, par slotishtype

    I have a 10 minute video and a 50 minute audio mp3. The video starts at 500 seconds into the audio. Using FFMPEG, how can I add the the audio to the video but specify a 500 seconds audio offset (So that they sync up)?

    EDIT:::::

    Down the bottom of this page it suggests how to specify an offset.

    $ ffmpeg -i video_source -itsoffet delay -i audio_source -map 0:x -map 1:y ......

    However, when I apply this, it still starts the audio from the start.

    Thanks

  • Encoding graphics into an mpeg stream

    5 novembre 2011, par eshalev

    looking for an example of how to programatically encode a frame-buffer into an mpeg stream. I need this to experiment with some mpeg encoders, to see how different patterns compress.

    I have a slight inclination towards Windows, although if linux gives some advantage it is not a problem.

  • Elimination compression from videos generated from images using ffmpeg ?

    5 novembre 2011, par Magz

    So I'm using ffmpeg to generate videos from a series of images. Unfortunately every video I've generated so far becomes compressed about halfway through (these are about 10-30 second videos). I've tried a lot of different options, but here's an example and the resulting output.

    Any suggestions?

    ffmpeg -minrate 5000k -maxrate 5000k -bufsize 1835k -b 5000k -s 480x480 \
    -f image2 -r 10 -i 'dms-%05d.jpeg' output.flv
    
    
    ffmpeg version 0.8.1, Copyright (c) 2000-2011 the FFmpeg developers
      built on Jul 29 2011 14:13:56 with gcc 4.2.1 (Apple Inc. build 5664)
      configuration: --enable-libmp3lame --enable-shared --disable-mmx --arch=x86_64
      libavutil    51.  9. 1 / 51.  9. 1
      libavcodec   53.  7. 0 / 53.  7. 0
      libavformat  53.  4. 0 / 53.  4. 0
      libavdevice  53.  1. 1 / 53.  1. 1
      libavfilter   2. 23. 0 /  2. 23. 0
      libswscale    2.  0. 0 /  2.  0. 0
    [image2 @ 0x101007c00] max_analyze_duration 5000000 reached at 5000000
    Input #0, image2, from 'dms-%05d.jpeg':
      Duration: 00:00:10.00, start: 0.000000, bitrate: N/A
        Stream #0.0: Video: mjpeg, yuvj444p, 559x480 [PAR 1:1 DAR 559:480], 10 fps, 10 tbr, 10 tbn, 10 tbc
    Incompatible pixel format 'yuvj444p' for codec 'flv', auto-selecting format 'yuv420p'
    [buffer @ 0x100d00230] w:559 h:480 pixfmt:yuvj444p tb:1/1000000 sar:1/1 sws_param:
    [buffersink @ 0x100d02160] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
    [scale @ 0x100d023a0] w:559 h:480 fmt:yuvj444p -> w:559 h:480 fmt:yuv420p flags:0x4
    Output #0, flv, to 'output.flv':
      Metadata:
        encoder         : Lavf53.4.0
        Stream #0.0: Video: flv, yuv420p, 559x480 [PAR 1:1 DAR 559:480], q=2-31, 200 kb/s, 1k tbn, 10 tbc
    Stream mapping:
      Stream #0.0 -> #0.0
    Press [q] to stop, [?] for help
    [buffer @ 0x100d00230] Buffer video input changed from size:559x480 fmt:yuvj444p to size:480x480 fmt:yuvj420p
    [scale @ 0x100d023a0] w:480 h:480 fmt:yuvj420p -> w:559 h:480 fmt:yuv420p flags:0x2
    [buffer @ 0x100d00230] Buffer video input changed from size:480x480 fmt:yuvj420p to size:559x480 fmt:yuvj444p
    [scale @ 0x100d023a0] w:559 h:480 fmt:yuvj444p -> w:559 h:480 fmt:yuv420p flags:0x2
    [buffer @ 0x100d00230] Buffer video input changed from size:559x480 fmt:yuvj444p to size:480x480 fmt:yuvj420p
    [scale @ 0x100d023a0] w:480 h:480 fmt:yuvj420p -> w:559 h:480 fmt:yuv420p flags:0x2
    [buffer @ 0x100d00230] Buffer video input changed from size:480x480 fmt:yuvj420p to size:559x480 fmt:yuvj444p
    [scale @ 0x100d023a0] w:559 h:480 fmt:yuvj444p -> w:559 h:480 fmt:yuv420p flags:0x2
    [buffer @ 0x100d00230] Buffer video input changed from size:559x480 fmt:yuvj444p to size:480x480 fmt:yuvj420p
    [scale @ 0x100d023a0] w:480 h:480 fmt:yuvj420p -> w:559 h:480 fmt:yuv420p flags:0x2
    [buffer @ 0x100d00230] Buffer video input changed from size:480x480 fmt:yuvj420p to size:559x480 fmt:yuvj444p
    [scale @ 0x100d023a0] w:559 h:480 fmt:yuvj444p -> w:559 h:480 fmt:yuv420p flags:0x2
    frame=  100 fps= 35 q=24.8 Lsize=    1062kB time=00:00:10.00 bitrate= 870.2kbits/s    
    video:1060kB audio:0kB global headers:0kB muxing overhead 0.166586%
    
  • Getting either incorrect output resolution or FPS from ffmpeg

    5 novembre 2011, par Adam

    I am capturing an RTSP stream from a security camera, and transcoding it for (live streaming) to iphone, using OSX as the encoding platform. I have it working correctly, and Im tuning it. However, it seems that it is not outputting the requested resolution. This is my script

    /Applications/SecurityCamera/openRTSP -v -c -t rtsp://10.0.1.118/ch1-s1 | \
        /Applications/SecurityCamera/ffmpeg \
        -r 10 -i - \
        -y -an -ab 64000 -f mpegts -vcodec copy -s 960x640 \
        -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 \
        -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16  -keyint_min 25 \
        -sc_threshold 40 -i_qfactor 0.71 -bt 400k -maxrate 524288 -bufsize 524288 \
        -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 \
        -aspect 960:640 -r 10 -g 10 -async 2 -\
        |/Applications/SecurityCamera/mediastreamsegmenter -b http://localhost:8080/\
          -f /Library/WebServer/Documents/ -i stream.m3u8 -t 10 -s 4 -D
    

    This is the status report:

    Input #0, h264, from 'pipe:':
    
      Duration: N/A, bitrate: N/A
      Stream #0.0: Video: h264, yuv420p, 1600x1200, 10 fps, 10 tbr, 1200k tbn, 20 tbc
      [mpegts @ 0x10100c200] muxrate VBR, pcr every 1 pkts, sdt every 200, pat/pmt every 40 pkts
      Output #0, mpegts, to 'pipe:':
      Metadata:
        encoder         : Lavf52.93.0
        Stream #0.0: Video: libx264, yuv420p, 1600x1200 [PAR 1:1 DAR 4:3], q=2-31, 90k tbn, 10 tbc
    Stream mapping:
      Stream #0.0 -> #0.0
    

    You can see that its working, but it is outputting 1600x1200 for some reason. (possibly -vcodec copy copies all codec parameters, not just the codec type?)

    If I change the -vcodec copy to -vcodec libx264 then I get the correct status report (stating 960x640, correct), but the streaming switches to 2 FPS (why? Im forcing both input and output!) and it halts after 54 frames (see output below)

    Seems stream 0 codec frame rate differs from container frame rate: 20.00 (20/1) -> 10.00 (20/2)
    Input #0, h264, from 'pipe:':
      Duration: N/A, bitrate: N/A
        Stream #0.0: Video: h264, yuv420p, 1600x1200, 10 fps, 10 tbr, 1200k tbn, 20 tbc
    [buffer @ 0x100d02420] w:1600 h:1200 pixfmt:yuv420p
    [scale @ 0x100d026f0] w:1600 h:1200 fmt:yuv420p -> w:960 h:640 fmt:yuv420p flags:0x4
    [libx264 @ 0x10100d400] using SAR=1/1
    [libx264 @ 0x10100d400] frame MB size (60x40) > level limit (1620)
    [libx264 @ 0x10100d400] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowCTZ SlowAtom
    [libx264 @ 0x10100d400] profile Constrained Baseline, level 3.0
    [mpegts @ 0x10100c200] muxrate VBR, pcr every 1 pkts, sdt every 200, pat/pmt every 40 pkts
    Output #0, mpegts, to 'pipe:':
      Metadata:
        encoder         : Lavf52.93.0
        Stream #0.0: Video: libx264, yuv420p, 960x640 [PAR 1:1 DAR 3:2], q=10-51, 200 kb/s, 90k tbn, 10 tbc
    Stream mapping:
      Stream #0.0 -> #0.0
    read pmap fffps=  3 q=37.0 size=      37kB time=0.10 bitrate=3008.0kbits/s    bits/s    
    video pid set at 100
    found sequence start
      next segment value 1026000
    written bytes 376 skipped 0
    frame=   54 fps=  2 q=-1.0 Lsize=     160kB time=5.40 bitrate= 242.0kbits/s    
    video:141kB audio:0kB global headers:0kB muxing overhead 12.872737%
    frame I:6     Avg QP:34.68  size: 23524
    [libx264 @ 0x10100d400] frame P:48    Avg QP:41.53  size:    75
    [libx264 @ 0x10100d400] mb I  I16..4: 63.9%  0.0% 36.1%
    [libx264 @ 0x10100d400] mb P  I16..4:  0.1%  0.0%  0.0%  P16..4:  0.8%  0.1%  0.0%  0.0%  0.0%    skip:99.0%
    [libx264 @ 0x10100d400] final ratefactor: 38.54
    [libx264 @ 0x10100d400] coded y,uvDC,uvAC intra: 57.7% 22.3% 2.0% inter: 0.0% 0.1% 0.0%
    [libx264 @ 0x10100d400] i16 v,h,dc,p: 23% 35% 27% 15%
    [libx264 @ 0x10100d400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 32% 16%  4%  3%  3%  7%  4%  8%
    [libx264 @ 0x10100d400] i8c dc,h,v,p: 83% 11%  5%  0%
    [libx264 @ 0x10100d400] kb/s:214.43
    
  • Encoding a group of images with ffmpeg or mencoder

    5 novembre 2011, par user846400

    I have a group of H.264 images (I-frames only) that I want to encode into JPEG with a single command. For a single image encoding, I can use the following (ffmpeg):

    ffmpeg -i raw_image image.jpg
    

    It works fine. What about a list of images? I have tried the following, but it doesn't work:

    ffmpeg -i raw_image%d image%d.jpg
    

    I need a solution either in ffmpeg or mencoder. Any help will be appreciated.