Newest 'ffmpeg' Questions - Stack Overflow

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

Articles published on the website

  • How to use amerge with offset in ffmpeg?

    26 November, by user14706760

    I'm trying to get a mono file out of 2 mono files with offset:

    ffmpeg -itsoffset 2 -i mono1.wav -itsoffset 8 -i mono2.wav -filter_complex [0:a][1:a]amerge out.wav
    

    But the result I'm getting is a stereo file without an offset. What do I do wrong?

  • Trimming audio using mp4Parser. Or is there any alternative?

    26 November, by user3892282

    I am trying to trim an audio using mp4Parser.
    Is that possible?

    I tried ffmpeg which is quite time consuming.
    Our app does require both video and audio processing.

    Any suggestions on this?

  • Setting B frames in a video with ffmpeg

    26 November, by roberutsu

    According to ffmpeg manual, setting -g is to define space between "I" frames, and setting -bf to use "B" frames. The former I got, but the latter not.

    The goal: I'm trying to have a video with a GOP 3,12 (M= 3, N=12). That means: 2 "B" frames separating each "P" frames, and "I" frames with 12 frames of distance. Or simply: "IBBPBBPBBPBBI"

    I think that I got only the N=12, using the commands below:

    1. ffmpeg -s cif -r 30 -b 64000 -bt 3200 -g 12 -y -i video.yuv -vcodec mpeg4 video.m4v
    2. MP4Box -hint -mtu 1460 -fps 30 -add video.m4v video.mp4
    3. ffmpeg -y -i video.mp4 video_ref.yuv
    4. ../cmd/psnr 352 288 420 video.yuv video_ref.yuv > psnr_ref.txt
    5. ../cmd/mp4trace -f -s 192.168.0.2 12346 video.mp4 > trace
    6. head -n 20 trace

    Result:

    [robert@10-2Fontes]$ head -n 20 trace
    1   H   12002   9   0.000
    2   P   11479   8   0.034
    3   P   12021   9   0.066
    4   P   11239   8   0.099
    5   P   5407    4   0.134
    6   P   2735    2   0.166
    7   P   1014    1   0.199
    8   P   850 1   0.232
    9   P   619 1   0.265
    10  P   979 1   0.298
    11  P   813 1   0.331
    12  P   806 1   0.364
    13  H   5109    4   0.396
    

    *Note, the most important is the command -g 12 in ffmpeg, but I writing all the commands. The video that I'm using is the "highway", from cif page videos: http://www2.tkn.tu-berlin.de/research/evalvid/cif.html

    I don't know why the result trace is using "H" instead of "I".

    I tried to put -bf 2 in ffmpeg command, but did not worked (I think because I saw no "B" indications in the result)

    List item

    ffmpeg -s cif -r 30 -b 64000 -bt 3200 -g 12 -bf 2 -y -i video.yuv -vcodec mpeg4 video.m4v
    

    Result:

    [robert@10-2Fontes]$ head -n 20 trace
    1   H   12002   9   0.001
    2   P   11479   8   0.034
    3   P   12021   9   0.067
    4   P   11239   8   0.100
    5   P   5407    4   0.132
    6   P   2735    2   0.166
    7   P   1014    1   0.199
    8   P   850 1   0.232
    9   P   619 1   0.265
    10  P   979 1   0.298
    11  P   813 1   0.331
    12  P   806 1   0.363
    13  H   5109    4   0.400
    
  • ffmpeg change metadata inside video file

    26 November, by virtualsets

    Hello I have problems to change timecode insdie metadata of a video file "mov"

    ruta=r"E:\Brutos-sin-eliminar\inma-ruben-22-2-2020\multicam\\"
    nombre=r"A019_02230134_C186.mov"
    comand="ffmpeg -i " + nombre + " -ss 0 -map 0 -acodec copy -vcodec copy -timecode 01:20:10:00 -metadata:s:2:0 timecode=01:20:10:00 -metadata:s:1:0 timecode=01:20:10:00 -metadata:s:0:2 -metadata:s:0:2  timecode=01:10:10:00"+ " convert_" + nombre
    
    os.popen(comand)
    

    I need to put muy own timecode to the file but this command not works.

    The console give me

      mov @ 00000225287fdc00] You requested a copy of the original timecode track so timecode metadata are now ignored
    Output #0, mov, to 'convert_A019_02230134_C186.mov':
      Metadata:
        major_brand     : qt  
        minor_version   : 537199360
        compatible_brands: qt  
        com.blackmagic-design.camera.windowedSensor: 1
        com.apple.proapps.manufacturer: Blackmagic Design
        com.blackmagic-design.camera.uuid: 3cf1dd9e-e307-47ff-864e-5487fea3fa47
        com.blackmagic-design.camera.projectFPS: 25
        com.apple.proapps.shootingRate: 50
        com.blackmagic-design.camera.cameraType: Blackmagic Pocket Cinema Camera 4K
        com.blackmagic-design.camera.shutterAngle: 180°
        com.blackmagic-design.camera.shutterMode: Angle
        com.blackmagic-design.camera.iso: 3200
        com.blackmagic-design.camera.whiteBalanceKelvin: 3000
        com.blackmagic-design.camera.whiteBalanceTint: -44
        com.apple.proapps.customgamma: com.blackmagic-design.camera.filmlog
        com.blackmagic-design.camera.look.LUTName: Blackmagic Pocket 4K Film to Extended Video.cube
        com.blackmagic-design.camera.guides.aspectRatio: 2:1
        com.blackmagic-design.camera.guides.safeArea: 90
        com.blackmagic-design.camera.firmware: 6.6
        com.apple.proapps.clipID: A019_02230134_C186
        com.apple.proapps.reel: 19
        com.apple.proapps.scene: 1
        com.apple.proapps.shot: 99
        com.apple.proapps.isGood: 0
        com.blackmagic-design.camera.environment: interior
        com.blackmagic-design.camera.dayNight: day
        com.apple.proapps.cameraName: A
        com.blackmagic-design.camera.colorScience: Blackmagic Pocket Cinema Camera 4K, Color Science Gen 4
        com.blackmagic-design.camera.dateRecorded: 2020:02:23
        timecode        : 01:20:10:00
        encoder         : Lavf58.11.101
        Stream #0:0(eng): Video: prores (apcn / 0x6E637061), yuv422p10le(bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 122315 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc (default)
        Metadata:
          creation_time   : 01:10:10:00
          handler_name    : ?Apple Alias Data Handler
          encoder         : Apple ProRes 422
          timecode        : 01:10:10:00
        Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s (default)
        Metadata:
          creation_time   : 2020-02-23T00:34:02.000000Z
          handler_name    : ?Apple Alias Data Handler
          timecode        : 01:20:10:00
        Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
        Metadata:
          creation_time   : 2020-02-23T00:34:02.000000Z
          handler_name    : ?Apple Alias Data Handler
          timecode        : 01:20:10:00
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #0:1 -> #0:1 (copy)
      Stream #0:2 -> #0:2 (copy)
    Press [q] to stop, [?] for help
    frame=  467 fps=0.0 q=-1.0 Lsize=  281452kB time=00:00:18.64 bitrate=123693.3kbits/s speed=71.1x    
    video:278913kB audio:2531kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.002533%
    

    I dont understand why not modificate the mov file... when open the metadata it is oringinal.

    Reggards

  • How to include font in FFMPEG command without using the fontfile option?

    26 November, by Avinash Modi

    I am using the following command to add watermark in my video using font TIMESNEWROMAN:

    ffmpeg -i input.webm -vf "drawtext=text='© Krishna':fontfile=C//:/Windows/Fonts/times.ttf:x=(main_w-text_w-10):y=(main_h-text_h-10):fontsize=32:fontcolor=black:box=1:boxcolor=white@0.5: boxborderw=5" -preset ultrafast output.mp4
    

    Now, I want to provide the font TIMESNEWROMAN or any other font instead of fontfile path. Is it possible to do that?