Recherche avancée

Médias (91)

Sur d’autres sites (114)

  • FFMPEG Removing audio from video makes the video short

    1er mai 2020, par Pratik Daigavane

    I was trying to remove audio from video using FFmpeg, the command I used is :

    



    ffmpeg -i video.mp4 -an -c copy no_sound.mp4


    



    But the length of the final video is less than the original video.

    



    Original Video Length - 0:05:43
Final Vidoe Length - 0:05:34

    



    Following is the output generated by FFmpeg :

    



        ffmpeg -i video.mp4 -an -c copy no_sound.mp4
ffmpeg version 4.2.2-1ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-3ubuntu1)
  configuration: --prefix=/usr --extra-version=1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01T00:00:00.000000Z
    encoder         : Lavf52.64.2
  Duration: 00:05:42.96, start: 0.000000, bitrate: 99 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 816x688 [SAR 1:1 DAR 51:43], 64 kb/s, 1.75 fps, 15 tbr, 15 tbn, 30 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, 33 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : SoundHandler
Output #0, mp4, to 'no_sound.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 816x688 [SAR 1:1 DAR 51:43], q=2-31, 64 kb/s, 1.75 fps, 15 tbr, 15360 tbn, 15 tbc (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  584 fps=0.0 q=-1.0 Lsize=    2629kB time=00:05:34.53 bitrate=  64.4kbits/s speed=5.78e+04x    
video:2621kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.313674%


    



    Why is this happening ?

    



    orignal video file link

    


  • FFMPEG command not working on MP4 files as expected

    21 février 2020, par DavidB

    I am trying to set the output time offset for mp4 file.

    ffmpeg -ss 13.554000 -i input.mp4 -c copy -t 10 -output_ts_offset 13.554000 output.mp4

    This code works for WEBM file as expected but not for MP4.
    In webm it delays start time of video to the specified timestamp and duration is 23.554 but in mp4 it just cuts the video, start time is set to 0 and duration is 10
    Cannot find what is problem.

    ffmpeg -ss 12.960000 -i v.mp4 -c copy -t 10  -output_ts_offset 12.960000 output.mp4
    ffmpeg version git-2019-12-26-b0d0d7e Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 9.2.1 (GCC) 20191125
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig
    --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb
    --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora
    --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp
    --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis
    --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid
    --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
    --enable-libopenmpt --enable-amf
     libavutil      56. 37.100 / 56. 37.100
     libavcodec     58. 65.100 / 58. 65.100
     libavformat    58. 35.101 / 58. 35.101
     libavdevice    58.  9.101 / 58.  9.101
     libavfilter     7. 69.101 /  7. 69.101
     libswscale      5.  6.100 /  5.  6.100
     libswresample   3.  6.100 /  3.  6.100
     libpostproc    55.  6.100 / 55.  6.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'v.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:29.57, start: 0.000000, bitrate: 1421 kb/s
       Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1032 kb/s, 25 fps, 25 tbr, 12800 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), 48000 Hz, 5.1, fltp, 383 kb/s (default)
       Metadata:
         creation_time   : 1970-01-01T00:00:00.000000Z
         handler_name    : SoundHandler
    Output #0, mp4, to 'output.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.35.101
       Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1032 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
       Metadata:
         creation_time   : 1970-01-01T00:00:00.000000Z
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default)
       Metadata:
         creation_time   : 1970-01-01T00:00:00.000000Z
         handler_name    : SoundHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    frame=  250 fps=0.0 q=-1.0 Lsize=    1687kB time=00:00:09.99 bitrate=1382.7kbits/s speed=2.21e+03x
    video:1212kB audio:468kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.408804%```
  • Trim video and extract thumbnail simultaneously

    12 septembre 2019, par Robin

    I am using the following two codes for ffmpeg.

    Trim Video :

    ffmpeg -i input.mp4 -ss 0 -t 100 -c copy -f mp4 output.mp4

    Create Thumbnail :

    ffmpeg -i input.mp4 -ss 1 -vframes 1 -f mjpeg output

    Which works as expected and is super fast, but when I combine the two like so :

    ffmpeg -i input.mp4 -ss 0 -t 100 -c copy -f mp4 output.mp4 -i input.mp4 -ss 1 -vframes 1 -f mjpeg output.jpeg

    ffmpeg runs a re-encoding copy rather than using -c copy. I really would like to execute both of these functions in a single ffmpeg command.

    Below is the output from terminal when it is generating the thumbnail, which is where it appears the re-encoding is happening.

     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.83.100
       Stream #1:0(und): Video: mjpeg, yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
       Metadata:
         creation_time   : 1970-01-01T00:00:00.000000Z
         handler_name    : VideoHandler
         encoder         : Lavc57.107.100 mjpeg
       Side data:
         cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    frame=  324 fps=0.0 q=-1.0 q=6.3 size=    1792kB time=00:00:12.94 bitrate=1133.7kbits/s dup=0 drop=285 speed=2
    frame=  661 fps=660 q=-1.0 q=6.3 size=    4096kB time=00:00:26.43 bitrate=1269.5kbits/s dup=0 drop=622 speed=2
    frame= 1013 fps=674 q=-1.0 q=6.3 size=    6912kB time=00:00:40.51 bitrate=1397.7kbits/s dup=0 drop=974 speed=
    frame= 1356 fps=677 q=-1.0 q=6.3 size=    8704kB time=00:00:54.22 bitrate=1314.9kbits/s dup=0 drop=1317 speed=
    frame= 1694 fps=677 q=-1.0 q=6.3 size=   11264kB time=00:01:07.75 bitrate=1361.9kbits/s dup=0 drop=1655 speed=
    frame= 2031 fps=676 q=-1.0 q=6.3 size=   14080kB time=00:01:21.23 bitrate=1419.8kbits/s dup=0 drop=1992 speed=
    frame= 2360 fps=673 q=-1.0 q=6.3 size=   16384kB time=00:01:34.37 bitrate=1422.1kbits/s dup=0 drop=2321 speed=
    frame= 2511 fps=672 q=-1.0 Lq=6.3 size=   17695kB time=00:01:40.40 bitrate=1443.8kbits/s dup=0 drop=2474 speed=26.9x    
    video:13036kB audio:4684kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown