Recherche avancée

Médias (1)

Mot : - Tags -/ogv

Sur d’autres sites (114)

  • Concatenate audio with image and video using ffmpeg

    9 mai 2018, par huynq9

    I have 1 image, 1 audio file and 1 video. I would like to merge all of them to make a video which will

    • show the image and play audio file for the first 10s
    • play the video file

    here is what I was trying to do so far.

    ffmpeg \
    -loop 1 -framerate 24 -t 10 -i item1.jpg \
    -i "https://audio-ssl.itunes.apple.com/apple-assets-us-std-000001/Music/66/58/f7/mzi.eoocfriy.aac.p.m4a" \
    -i item4.mp4 \
    -filter_complex \
    "[0]scale=432:432,setdar=1[img1]; \
    [1]volume=1[aud1]; \
    [2]scale=432:432,setdar=1[vid1]; \
    [img1][aud1][vid1] concat=n=3:v=1:a=1" \
    outputfile.mp4

    I got the error :

    [Parsed_setdar_4 @ 0x3063780] Media type mismatch between the
    ’Parsed_setdar_4’ filter output pad 0 (video) and the
    ’Parsed_concat_6’ filter input pad 1 (audio) [AVFilterGraph @
    0x30479a0] Cannot create the link setdar:0 -> concat:1 Error
    initializing complex filters. Invalid argument

    I tried to googled but still cannot figure out what I am doing wrong ?

    Updated :
    I ran the following command :

    ffmpeg \
    -loop 1 -framerate 24 -t 10 -i item1.jpg \
    -t 10 -i "https://audio-ssl.itunes.apple.com/apple-assets-us-std-000001/Music/66/58/f7/mzi.eoocfriy.aac.p.m4a" \
    -i item4.mp4 \
    -f lavfi -t 1 -i anullsrc \
    -filter_complex \
    "[0]scale=432:432,setsar=1[img1]; \
    [2]scale=432:432,setsar=1[vid1]; \
    [img1][1][vid1][3] concat=n=2:v=1:a=1" \
    outputfile.mp4

    and got the following error :

    ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
     configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --disable-ffserver --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libtheora --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc --enable-libzimg
     libavutil      55. 58.100 / 55. 58.100
     libavcodec     57. 89.100 / 57. 89.100
     libavformat    57. 71.100 / 57. 71.100
     libavdevice    57.  6.100 / 57.  6.100
     libavfilter     6. 82.100 /  6. 82.100
     libavresample   3.  5.  0 /  3.  5.  0
     libswscale      4.  6.100 /  4.  6.100
     libswresample   2.  7.100 /  2.  7.100
     libpostproc    54.  5.100 / 54.  5.100
    Input #0, image2, from 'item1.jpg':
     Duration: 00:00:00.04, start: 0.000000, bitrate: 8365 kb/s
       Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 432x432 [SAR 1:1 DAR 1:1], 24 fps, 24 tbr, 24 tbn, 24 tbc
    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'https://audio-ssl.itunes.apple.com/apple-assets-us-std-000001/Music/66/58/f7/mzi.eoocfriy.aac.p.m4a':
     Metadata:
       major_brand     : M4A
       minor_version   : 0
       compatible_brands: M4A mp42isom
       creation_time   : 1983-06-16T23:20:44.000000Z
       iTunSMPB        :  00000000 00000840 00000000 00000000001423C0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
     Duration: 00:00:29.98, start: 0.047891, bitrate: 285 kb/s
       Stream #1:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 271 kb/s (default)
       Metadata:
         creation_time   : 1983-06-16T23:20:44.000000Z
    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'item4.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       creation_time   : 1970-01-01T00:00:00.000000Z
       encoder         : Lavf53.24.2
     Duration: 00:00:13.70, start: 0.000000, bitrate: 615 kb/s
       Stream #2:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 229 kb/s, 15 fps, 15 tbr, 15360 tbn, 30 tbc (default)
       Metadata:
         creation_time   : 1970-01-01T00:00:00.000000Z
         handler_name    : VideoHandler
       Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 382 kb/s (default)
       Metadata:
         creation_time   : 1970-01-01T00:00:00.000000Z
         handler_name    : SoundHandler
    Input #3, lavfi, from 'anullsrc':
     Duration: N/A, start: 0.000000, bitrate: 705 kb/s
       Stream #3:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s
    [AVFilterGraph @ 0x3955e20] No such filter: ' '
    Error initializing complex filters.
    Invalid argument
  • FFMPEG - it takes frames from .avi but doesn't work for mp4

    15 mai 2019, par Zector

    I run the following PHP code in a loop in order to extract the frame from 10th second from a list of video (avi & mp4) :

    $command = "$ffmpegpath -y -i $input  -vframes 1 -ss 00:00:$fromdurasec -y $output";

    It seems that it generates frames for avi files but not for mp4.

    When I run the command manually in command-line it works as expected (as in takes the frame and saves it in folder). Please find below the full log of ffmpeg process :

    ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
    built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
    configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --enable-libmp3lame --enable-libx264 --enable-libvorbis --
    enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libopencore-amrnb --enable-gray --enable-libopenjpeg --enable-gnutls --enable-libfaac --enable-nonfree --disable-indev=sndio --disable-outdev=sndio --cc=gcc
    libavutil      55. 17.103 / 55. 17.103
    libavcodec     57. 24.102 / 57. 24.102
    libavformat    57. 25.100 / 57. 25.100
    libavdevice    57.  0.101 / 57.  0.101
    libavfilter     6. 31.100 /  6. 31.100
    libswscale      4.  0.100 /  4.  0.100
    libswresample   2.  0.101 /  2.  0.101
    libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'new test video.mp4':
    Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf52.93.0
    Duration: 00:22:19.33, start: 0.000000, bitrate: 3560 kb/s
    Stream #0:0(rus): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 3427 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
    Metadata:
     creation_time   : 1970-01-01 00:00:00
     handler_name    : VideoHandler
    Stream #0:1(rus): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
     creation_time   : 1970-01-01 00:00:00
     handler_name    : SoundHandler
    [swscaler @ 0x20b0140] deprecated pixel format used, make sure you did set range correctly
    Output #0, image2, to 'newtest.jpg':
    Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.25.100
    Stream #0:0(rus): Video: mjpeg, yuvj420p(pc), 1280x720, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
     creation_time   : 1970-01-01 00:00:00
     handler_name    : VideoHandler
     encoder         : Lavc57.24.102 mjpeg
    Side data:
     unknown side data type 10 (24 bytes)
    Stream mapping:
    Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
    Press [q] to stop, [?] for help
    frame=    0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x
    Enter command: <target>|all <time>|-1 <command>[ <argument>]
    </argument></command></time></target>
  • Video parameters for best web scrolling performance [duplicate]

    22 février 2018, par biven

    There is web application which provides next workflow. User uploads video -> backend(by using ffmpeg) transform this video for smaller size(320x240) -> web browser plays transformed video. Key feature of this application should be excellent scrolling possibility of video by progress bar. I mean that video should be scrolled as smoothly as possible (without any jumps) when user moves progress bar position back and forward.

    I thought that small size of video helps to provide good scrolling possibility. But that’s incorrect. I have 2 different videos, one scrolling perfect(as I want), second has same resolotion(320x240), but it is scrolling with jumps and breaks.

    By ffprobe I compared both videos and I have next results :

    Video 1(good scrolling) :

    libavutil      56.  7.100 / 56.  7.100
     libavcodec     58.  9.100 / 58.  9.100
     libavformat    58.  5.100 / 58.  5.100
     libavdevice    58.  0.101 / 58.  0.101
     libavfilter     7. 11.101 /  7. 11.101
     libswscale      5.  0.101 /  5.  0.101
     libswresample   3.  0.101 /  3.  0.101
     libpostproc    55.  0.100 / 55.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'spacetestSMALL_512kb.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: mp41
       creation_time   : 1970-01-01T00:00:00.000000Z
       title           : small test video - http://www.archive.org/details/alanoakleysmalltestvideo
       encoder         : Lavf51.10.0
       comment         : license:  http://www.copyright.gov/
     Duration: 00:00:48.32, start: 0.000000, bitrate: 555 kb/s
       Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x240, 505 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
       Metadata:
         creation_time   : 1970-01-01T00:00:00.000000Z
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 45 kb/s (default)
       Metadata:
         creation_time   : 1970-01-01T00:00:00.000000Z
         handler_name    : SoundHandler

    Video 2(bad scrolling) :

    libavutil      56.  7.100 / 56.  7.100
     libavcodec     58.  9.100 / 58.  9.100
     libavformat    58.  5.100 / 58.  5.100
     libavdevice    58.  0.101 / 58.  0.101
     libavfilter     7. 11.101 /  7. 11.101
     libswscale      5.  0.101 /  5.  0.101
     libswresample   3.  0.101 /  3.  0.101
     libpostproc    55.  0.100 / 55.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'e10b1c93-5325-4500-ae7c-12ccd0f617bd.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.5.100
     Duration: 00:00:07.96, start: 0.000000, bitrate: 428 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 4:3 DAR 16:9], 391 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 33 kb/s (default)
       Metadata:
         handler_name    : SoundHandler

    What is the key parameter of video which provide possibility for good scrolling in web browser ?