首页 > 系统相关 >linux 入门(七)-ffmpeg使用

linux 入门(七)-ffmpeg使用

时间:2024-03-07 16:56:31浏览次数:25  
标签:enable 入门 stream -- mp4 file linux output ffmpeg

linux 入门(七)

1: 安装ffmpeg

ubuntu下安装ffmpeg:

sudo apt-get install ffmpeg

2: ffmpeg --help

ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --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
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Getting help:
    -h      -- print basic options
    -h long -- print more options
    -h full -- print all options (including all format and codec specific options, very long)
    -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf
    See man ffmpeg for detailed description of the options.

Print help / information / capabilities:
-L                  show license
-h topic            show help
-? topic            show help
-help topic         show help
--help topic        show help
-version            show version
-buildconf          show build configuration
-formats            show available formats
-muxers             show available muxers
-demuxers           show available demuxers
-devices            show available devices
-codecs             show available codecs
-decoders           show available decoders
-encoders           show available encoders
-bsfs               show available bit stream filters
-protocols          show available protocols
-filters            show available filters
-pix_fmts           show available pixel formats
-layouts            show standard channel layouts
-sample_fmts        show available audio sample formats
-colors             show available color names
-sources device     list sources of the input device
-sinks device       list sinks of the output device
-hwaccels           show available HW acceleration methods

Global options (affect whole program instead of just one file:
-loglevel loglevel  set logging level
-v loglevel         set logging level
-report             generate a report
-max_alloc bytes    set maximum size of a single allocated block
-y                  overwrite output files
-n                  never overwrite output files
-ignore_unknown     Ignore unknown stream types
-filter_threads     number of non-complex filter threads
-filter_complex_threads  number of threads for -filter_complex
-stats              print progress report during encoding
-max_error_rate maximum error rate  ratio of errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.
-bits_per_raw_sample number  set the number of bits per raw sample
-vol volume         change audio volume (256=normal)

Per-file main options:
-f fmt              force format
-c codec            codec name
-codec codec        codec name
-pre preset         preset name
-map_metadata outfile[,metadata]:infile[,metadata]  set metadata information of outfile from infile
-t duration         record or transcode "duration" seconds of audio/video
-to time_stop       record or transcode stop time
-fs limit_size      set the limit file size in bytes
-ss time_off        set the start time offset
-sseof time_off     set the start time offset relative to EOF
-seek_timestamp     enable/disable seeking by timestamp with -ss
-timestamp time     set the recording timestamp ('now' to set the current time)
-metadata string=string  add metadata
-program title=string:st=number...  add program with specified streams
-target type        specify target file type ("vcd", "svcd", "dvd", "dv" or "dv50" with optional prefixes "pal-", "ntsc-" or "film-")
-apad               audio pad
-frames number      set the number of frames to output
-filter filter_graph  set stream filtergraph
-filter_script filename  read stream filtergraph description from a file
-reinit_filter      reinit filtergraph on input parameter changes
-discard            discard
-disposition        disposition

Video options:
-vframes number     set the number of video frames to output
-r rate             set frame rate (Hz value, fraction or abbreviation)
-s size             set frame size (WxH or abbreviation)
-aspect aspect      set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
-bits_per_raw_sample number  set the number of bits per raw sample
-vn                 disable video
-vcodec codec       force video codec ('copy' to copy stream)
-timecode hh:mm:ss[:;.]ff  set initial TimeCode value.
-pass n             select the pass number (1 to 3)
-vf filter_graph    set video filters
-ab bitrate         audio bitrate (please use -b:a)
-b bitrate          video bitrate (please use -b:v)
-dn                 disable data

Audio options:
-aframes number     set the number of audio frames to output
-aq quality         set audio quality (codec-specific)
-ar rate            set audio sampling rate (in Hz)
-ac channels        set number of audio channels
-an                 disable audio
-acodec codec       force audio codec ('copy' to copy stream)
-vol volume         change audio volume (256=normal)
-af filter_graph    set audio filters

Subtitle options:
-s size             set frame size (WxH or abbreviation)
-sn                 disable subtitle
-scodec codec       force subtitle codec ('copy' to copy stream)
-stag fourcc/tag    force subtitle tag/fourcc
-fix_sub_duration   fix subtitles duration
-canvas_size size   set canvas size (WxH or abbreviation)
-spre preset        set the subtitle options to the indicated preset

3: 转码

转码视频格式只需要执行下面的命令即可:

ffmpeg -i share_5eb7ba669e87b5ab48d50107a249a1c1.mp4 test1.avi

输出如下:

ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --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 'share_5eb7ba669e87b5ab48d50107a249a1c1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    comment         : vid:v0300fg10000cl7lp5bc77ubt3j4km1g
    encoder         : Lavf58.76.100
  Duration: 00:00:15.30, start: 0.000000, bitrate: 1676 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x1280 [SAR 1:1 DAR 9:16], 1543 kb/s, 54.28 fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native))
  Stream #0:1 -> #0:1 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, avi, to 'test1.avi':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    ICMT            : vid:v0300fg10000cl7lp5bc77ubt3j4km1g
    ISFT            : Lavf58.29.100
    Stream #0:0(und): Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 720x1280 [SAR 1:1 DAR 9:16], q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.54.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.54.100 libmp3lame
frame=  826 fps=514 q=31.0 Lsize=    3354kB time=00:00:15.30 bitrate=1795.0kbits/s speed=9.53x    
video:3069kB audio:240kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.374900%

3: 视频压缩

  1. 指定尺寸

    ffmpeg -i share_5eb7ba669e87b5ab48d50107a249a1c1.mp4 -s 720x360 test1.mp4
    

    原视频1280x720, 大小3.3m, 修改后720x360 ,大小1.5M.

  2. 修改帧率

    ffmpeg -i share_5eb7ba669e87b5ab48d50107a249a1c1.mp4 -r 20  test5.mp4
    

    原视频帧率60, 大小3.3M. 修改帧率为20后, 大小为2.9M

  3. 限定视频大小

    ffmpeg -i share_5eb7ba669e87b5ab48d50107a249a1c1.mp4 -fs 1MB  test6.mp4
    

    该命令会限制输出文件的大小为1MB.

    但是-fs参数并不会保证输出的文件在1MB. 它只是告诉ffmpeg在输出文件到达1MB后停止输出.

    并且, 如果该命令会导致输出视频的长度发生变化,比如之前是16s的视频, 输出只有3s.

4: 视频裁剪

ffmpeg -i share_5eb7ba669e87b5ab48d50107a249a1c1.mp4 -ss 00:00:10 -to 00:00:13 -c copy test7.mp4
  1. "-ss" 参数表示开始裁剪的时间,
  2. "-to" 参数表示裁剪到的时间
  3. "-c copy" 表示复制原始视频的编码格式。

5: 合并视频

将两个视频直接拼接:

创建mp4.txt文件 ,写入需要拼接的视频的路径.如:

file 'share_5eb7ba669e87b5ab48d50107a249a1c1.mp4'file 'test1.mp4'

执行命令:

ffmpeg -f concat -i mp4.txt -c copy test8.mp4

如果某一个视频有问题,如:无法播放或者文件不存在. 则输出如下:

ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --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[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55964a0ff340] Auto-inserting h264_mp4toannexb bitstream filterInput #0, concat, from 'mp4.txt':  Duration: N/A, start: -0.046440, bitrate: 1671 kb/s    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x1280 [SAR 1:1 DAR 9:16], 1543 kb/s, 54.28 fps, 60 tbr, 15360 tbn, 120 tbc    Metadata:      handler_name    : VideoHandler    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s    Metadata:      handler_name    : SoundHandlerOutput #0, mp4, to 'test8.mp4':  Metadata:    encoder         : Lavf58.29.100    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x1280 [SAR 1:1 DAR 9:16], q=2-31, 1543 kb/s, 54.28 fps, 60 tbr, 15360 tbn, 15360 tbc    Metadata:      handler_name    : VideoHandler    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s    Metadata:      handler_name    : SoundHandlerStream mapping:  Stream #0:0 -> #0:0 (copy)  Stream #0:1 -> #0:1 (copy)Press [q] to stop, [?] for help[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55964a118200] moov atom not found[concat @ 0x55964a0f56c0] Impossible to open 'test1.mp4'mp4.txt: Invalid data found when processing inputframe=  826 fps=0.0 q=-1.0 Lsize=    3131kB time=00:00:15.32 bitrate=1673.6kbits/s speed=1.23e+03x    video:2867kB audio:240kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.780092%

此时仍然可以生成视频,只是只有第一个视频, 第二个未拼接成功.

第二种情况:

两个视频的帧率,分辨率, 编解码器不同.

虽然可以成功拼接,但是效果却差强人意:

ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --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[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55acf6064340] Auto-inserting h264_mp4toannexb bitstream filterInput #0, concat, from 'mp4.txt':  Duration: N/A, start: -0.046440, bitrate: 1671 kb/s    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x1280 [SAR 1:1 DAR 9:16], 1543 kb/s, 54.28 fps, 60 tbr, 15360 tbn, 120 tbc    Metadata:      handler_name    : VideoHandler    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s    Metadata:      handler_name    : SoundHandlerOutput #0, mp4, to 'test8.mp4':  Metadata:    encoder         : Lavf58.29.100    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x1280 [SAR 1:1 DAR 9:16], q=2-31, 1543 kb/s, 54.28 fps, 60 tbr, 15360 tbn, 15360 tbc    Metadata:      handler_name    : VideoHandler    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s    Metadata:      handler_name    : SoundHandlerStream mapping:  Stream #0:0 -> #0:0 (copy)  Stream #0:1 -> #0:1 (copy)Press [q] to stop, [?] for help[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55acf607d200] Auto-inserting h264_mp4toannexb bitstream filter[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675840, current: 124565; changing to 675841. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675841, current: 125589; changing to 675842. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675842, current: 126613; changing to 675843. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675843, current: 127637; changing to 675844. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675844, current: 128661; changing to 675845. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675845, current: 129685; changing to 675846. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675846, current: 130709; changing to 675847. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675847, current: 131733; changing to 675848. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675848, current: 132757; changing to 675849. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675849, current: 133781; changing to 675850. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675850, current: 134805; changing to 675851. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675851, current: 135829; changing to 675852. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675852, current: 136853; changing to 675853. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675853, current: 137877; changing to 675854. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675854, current: 138901; changing to 675855. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675855, current: 139925; changing to 675856. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675856, current: 140949; changing to 675857. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675857, current: 141973; changing to 675858. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675858, current: 142997; changing to 675859. This may result in incorrect timestamps in the output file.[mp4 @ 0x55acf609df40] Non-monotonous DTS in output stream 0:1; previous: 675859, current: 144021; changing to 675860. This may result in incorrect timestamps in the output file.frame=  903 fps=0.0 q=-1.0 Lsize=    3219kB time=00:01:44.78 bitrate= 251.7kbits/s speed=4.89e+03x    video:2951kB audio:244kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.774971%

生成的视频时长与 两个视频拼接的长度不一致.

我们直接将相同的两个视频拼接,此时:

file 'share_5eb7ba669e87b5ab48d50107a249a1c1.mp4'file 'share_5eb7ba669e87b5ab48d50107a249a1c1.mp4'

最终可以拼接成功.

如果需要解决这个问题,则需要我们使用ffmpeg的其他选项进行转码和调整,保证两个视频的格式统一后,进行拼接.

本文由博客一文多发平台 OpenWrite 发布!

标签:enable,入门,stream,--,mp4,file,linux,output,ffmpeg
From: https://www.cnblogs.com/zhjing/p/18059280

相关文章

  • 使用jenkins连接linux部署jar包
    jenkins安装首先安装jenkins,我们可以使用docker安装。用下面命令拉取jenkins镜像。dockerpulljenkins/jenkins然后正常安装jenkins容器即可。安装完成后,进入jenkins管理界面。会让我们输入初始化密码,和创建默认用户。我们按照提示操作即可。然后,用默认用户登录,进入界面如......
  • linux脚本:/bin/bash^M: bad interpreter: No such file or directory(/bin/sh^M).sh: no
    origin如图,运行一个脚本文件报错: 原因:在执行shell脚本时提示这样的错误主要是由于shell脚本文件是dos格式,即每一行结尾以\r\n来标识,而unix格式的文件行尾则以\n来标识解决方法,用dos2unixfilename命令,,直接把文件转换为unix格式 其他解决方法:(1)使用linux命令dos2unixfi......
  • flutter入门 3 - flutter 运行
    flutter项目新建与运行vscodecommand+shift+p:输入flutter,选择newproject,application,选择一个项目存储的文件夹,会新建一个flutter项目然后会直接打开该项目,到lib下main.dartvscodecommand+shift+p:输入flutter,选择device,选择要运行项目的设备但是运行项目设备选择......
  • flutter入门2——环境搭建
    背景学习flutter之前,我们要先安装flutter环境,保证可以创建flutter项目,可以查看模拟器,可以热重载等。在看本文之前,最好先通读下官方安装文档:https://docs.flutter.dev/get-started/install/macos/desktop环境安装无论是windows还是macos,都要预留至少10g的内存,因为......
  • flutter入门1——概念简介
    简介Flutter是Google开发的一个开源移动应用框架,用于构建高性能、高保真的跨平台应用。它使用Dart语言作为开发语言,具有许多独特的特点和优势。特点跨平台性:Flutter支持Android和iOS两大主流移动平台,开发者可以使用同一套代码库来构建应用,大大减少了开发和维护的成本。高性能......
  • Subversion svn 开源的版本控制系统入门介绍 VCS
    拓展阅读Subversion开源的版本控制系统入门介绍VCSGit开源的版本控制系统-01-入门使用介绍Git开源的版本控制系统-02-baseusage基本用法Git开源的版本控制系统-03-时间数据回溯Git开源的版本控制系统-04-branchmanage分支管理Git开源的版本控制系统-05-tags标签......
  • Arch Linux使用archinstall快速安装配置2024版
    ArchLinux使用archinstall快速安装配置2024版参考:https://wiki.archlinuxcn.org/wiki/安装指南官方安装指南比较繁琐,有提供archinstall​但是并没有详细介绍对应配置项,本教程根据自身安装经历编写安装前的准备[​编辑|编辑源代码]获取安装映像[​编辑|编辑源代......
  • Arch Linux使用archinstall快速安装配置2024版
    ArchLinux使用archinstall快速安装配置2024版参考:https://wiki.archlinuxcn.org/wiki/安装指南官方安装指南比较繁琐,有提供archinstall​但是并没有详细介绍对应配置项,本教程根据自身安装经历编写安装前的准备[​编辑|编辑源代码]获取安装映像[​编辑|编辑源代......
  • linux 下安装字体
    (1)找到Windows系统的字体文件夹:Windows字体的系统路径是C:\Windows\Fonts(2)远程登陆Linux系统远程登陆到自己的Linux系统后,先切换到/usr/share/fonts/目录下在该目录下新建chinese文件夹,代表这里面存放的是中文字体(3)更改字体权限chmod755/usr/share/fo......
  • Git in Linux
    frompixiv问题起因由于之前都是再window上用git将代码上传到github上,但是这次要用Linux了。由于之前不知道什么时候window上用了ssh,导致我在window上很轻松就用git上传到github了。但是在linux上没想到要我输入密码在查询之后发现,github上传方式有两种:http/https在使用......