`
lobin
  • 浏览: 427377 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

FFmpeg: 视频处理

 
阅读更多

视频处理

 

查看视频信息

./ffprobe.exe /cygdrive/h/IMG_0024.mp4

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/cygdrive/h/IMG_0024.mp4':

  Metadata:

    major_brand     : mp42

    minor_version   : 1

    compatible_brands: isommp41mp42

    creation_time   : 2020-08-25 17:54:46

  Duration: 00:03:00.05, start: 0.000000, bitrate: 836 kb/s

    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)

    Metadata:

      creation_time   : 2020-08-25 17:54:46

      handler_name    : Core Media Audio

    Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 320x568, 706 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 23976 tbc (default)

    Metadata:

      creation_time   : 2020-08-25 17:54:46

      handler_name    : Core Media Video

 

可以看出IMG_0024.mp4视频中包括音频视频2种流,音频流格式为aac,视频流格式为h264。

 

./ffprobe.exe -show_format /cygdrive/h/IMG_0024.mp4

 

./ffprobe.exe -show_streams /cygdrive/h/IMG_0024.mp4

 

视频格式转换

通过ffmpeg 命令对视频进行格式转换,然后通过ffprobe命令查看转换后的视频格式。

 

转换之前的视频格式:

./ffprobe.exe /cygdrive/h/IMG_0024.mp4

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/cygdrive/h/IMG_0024.mp4':

  Metadata:

    major_brand     : mp42

    minor_version   : 1

    compatible_brands: isommp41mp42

    creation_time   : 2020-08-25 17:54:46

  Duration: 00:03:00.05, start: 0.000000, bitrate: 836 kb/s

    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)

    Metadata:

      creation_time   : 2020-08-25 17:54:46

      handler_name    : Core Media Audio

    Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 320x568, 706 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 23976 tbc (default)

    Metadata:

      creation_time   : 2020-08-25 17:54:46

      handler_name    : Core Media Video

 

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 /cygdrive/h/IMG_0024.avi

 

转换之后的视频格式:

./ffprobe.exe /cygdrive/h/IMG_0024.avi

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, avi, from '/cygdrive/h/IMG_0024.avi':

  Metadata:

    encoder         : Lavf56.36.100

  Duration: 00:03:00.11, start: 0.000000, bitrate: 555 kb/s

    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 320x568 [SAR 1:1 DAR 40:71], 352 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 2997 tbc

    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 44100 Hz, stereo, fltp, 192 kb/s

 

可以看到之前的视频流格式为h264,转换后的视频流格式为mpeg4。

 

视频转换为yuv格式:

yuv格式是一种原始格式。

 

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 /cygdrive/h/IMG_0024.yuv

 

./ffprobe.exe /cygdrive/h/IMG_0024.yuv

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

[IMGUTILS @ 0x22a614] Picture size 0x0 is invalid

[IMGUTILS @ 0x22a194] Picture size 0x0 is invalid

[rawvideo @ 0x2001a200] Could not find codec parameters for stream 0 (Video: rawvideo (I420 / 0x30323449), yuv420p, -4 kb/s): unspecified size

Consider increasing the value for the 'analyzeduration' and 'probesize' options

/cygdrive/h/IMG_0024.yuv: Operation not permitted

 

另一种方式转换为yuv格式:指定“-c:v y41p”

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 -c:v y41p /cygdrive/h/IMG_0024-c:v_y41p.yuv

 

./ffprobe.exe /cygdrive/h/IMG_0024-c:v_y41p.yuv                               ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

[IMGUTILS @ 0x22a614] Picture size 0x0 is invalid

[IMGUTILS @ 0x22a194] Picture size 0x0 is invalid

[rawvideo @ 0x2001a200] Could not find codec parameters for stream 0 (Video: rawvideo (I420 / 0x30323449), yuv420p, -4 kb/s): unspecified size

Consider increasing the value for the 'analyzeduration' and 'probesize' options

/cygdrive/h/IMG_0024-c:v_y41p.yuv: Operation not permitted

 

视频转换为flv格式:

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 /cygdrive/h/IMG_0024.flv

 

./ffprobe.exe /cygdrive/h/IMG_0024.flv

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, flv, from '/cygdrive/h/IMG_0024.flv':

  Metadata:

    major_brand     : mp42

    minor_version   : 1

    compatible_brands: isommp41mp42

    encoder         : Lavf56.36.100

  Duration: 00:03:00.09, start: 0.000000, bitrate: 773 kb/s

    Stream #0:0: Video: flv1, yuv420p, 320x568, 200 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc

    Stream #0:1: Audio: adpcm_swf, 44100 Hz, stereo, s16, 352 kb/s

 

视频转换为mpg格式:

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 /cygdrive/h/IMG_0024.mpg

 

./ffprobe.exe /cygdrive/h/IMG_0024.mpg

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, mpeg, from '/cygdrive/h/IMG_0024.mpg':

  Duration: 00:03:00.09, start: 0.522456, bitrate: 856 kb/s

    Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p(tv), 320x568 [SAR 1:1 DAR 40:71], 104857 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 29.97 tbc

    Stream #0:1[0x1c0]: Audio: mp2, 44100 Hz, stereo, s16p, 384 kb/s

 

另一种方式转换为mpg格式:指定“-c:v mpeg1video”

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 -c:v mpeg1video /cygdrive/h/IMG_0024-c:v_mpeg1video.mpg

 

./ffprobe.exe /cygdrive/h/IMG_0024-c:v_mpeg1video.mpg

 

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, mpeg, from '/cygdrive/h/IMG_0024-c:v_mpeg1video.mpg':

  Duration: 00:03:00.09, start: 0.522456, bitrate: 856 kb/s

    Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p(tv), 320x568 [SAR 1:1 DAR 40:71], 104857 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 29.97 tbc

    Stream #0:1[0x1c0]: Audio: mp2, 44100 Hz, stereo, s16p, 384 kb/s

 

 

视频转换为mp4格式:

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 -strict -2 /cygdrive/h/IMG_0024-t.mp4

 

./ffprobe.exe /cygdrive/h/IMG_0024-t.mp4

 

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/cygdrive/h/IMG_0024-t.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2mp41

    encoder         : Lavf56.36.100

  Duration: 00:03:00.12, start: 0.023220, bitrate: 488 kb/s

    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x568 [SAR 1:1 DAR 40:71], 353 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 2997 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

 

另一种方式转换为mp4格式:指定“-c:v mpeg4”

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 -strict -2 -c:v mpeg4 /cygdrive/h/IMG_0024-t2.mp4

 

./ffprobe.exe /cygdrive/h/IMG_0024-t2.mp4

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/cygdrive/h/IMG_0024-t2.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2mp41

    encoder         : Lavf56.36.100

  Duration: 00:03:00.12, start: 0.023220, bitrate: 488 kb/s

    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x568 [SAR 1:1 DAR 40:71], 353 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 2997 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

 

视频转换为wmv格式:

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 /cygdrive/h/IMG_0024.wmv

 

./ffprobe.exe /cygdrive/h/IMG_0024.wmv

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, asf, from '/cygdrive/h/IMG_0024.wmv':

  Metadata:

    major_brand     : mp42

    minor_version   : 1

    compatible_brands: isommp41mp42

    encoder         : Lavf56.36.100

  Duration: 00:03:00.14, start: 0.000000, bitrate: 514 kb/s

    Stream #0:0: Video: msmpeg4v3 (MP43 / 0x3334504D), yuv420p, 320x568, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc

    Stream #0:1: Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 2 channels, fltp, 128 kb/s

 

 

另一种方式转换为wmv格式:指定“-c:v msmpeg4v3”

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 -c:v msmpeg4v3 /cygdrive/h/IMG_0024-c:v_msmpeg4v3.wmv

 

./ffprobe.exe /cygdrive/h/IMG_0024-c:v_msmpeg4v3.wmv

 

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, asf, from '/cygdrive/h/IMG_0024-c:v_msmpeg4v3.wmv':

  Metadata:

    major_brand     : mp42

    minor_version   : 1

    compatible_brands: isommp41mp42

    encoder         : Lavf56.36.100

  Duration: 00:03:00.14, start: 0.000000, bitrate: 514 kb/s

    Stream #0:0: Video: msmpeg4v3 (MP43 / 0x3334504D), yuv420p, 320x568, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc

    Stream #0:1: Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 2 channels, fltp, 128 kb/s

 

视频格式转换:指定帧大小

-s size             set frame size (WxH or abbreviation)

 

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 -c:v y41p -s 320x180 /cygdrive/h/IMG_0024-c-v_y41p-s_320x180.yuv

 

./ffprobe.exe /cygdrive/h/IMG_0024-c-v_y41p-s_320x180.yuv                     ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

[IMGUTILS @ 0x22a614] Picture size 0x0 is invalid

[IMGUTILS @ 0x22a194] Picture size 0x0 is invalid

[rawvideo @ 0x2001a200] Could not find codec parameters for stream 0 (Video: rawvideo (I420 / 0x30323449), yuv420p, -4 kb/s): unspecified size

Consider increasing the value for the 'analyzeduration' and 'probesize' options

/cygdrive/h/IMG_0024-c-v_y41p-s_320x180.yuv: Operation not permitted

 

只提取视频中的视频流,丢弃音频流:

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 -vcodec copy -an /cygdrive/h/IMG_0024-vcodec_copy-an.mp4

 

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/cygdrive/h/IMG_0024-vcodec_copy-an.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2avc1mp41

    encoder         : Lavf56.36.100

  Duration: 00:03:00.05, start: 0.000000, bitrate: 709 kb/s

    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 320x568, 706 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 23976 tbc (default)

    Metadata:

      handler_name    : VideoHandler

 

 

视频合成:将一段视频和一段音频合成

 

先准备一个视频文件IMG_0024-audio.mp4,只有视频流:

./ffprobe.exe /cygdrive/h/IMG_0024-audio.mp4

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/cygdrive/h/IMG_0024-audio.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2avc1mp41

    encoder         : Lavf56.36.100

  Duration: 00:03:00.05, start: 0.000000, bitrate: 709 kb/s

    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 320x568, 706 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 23976 tbc (default)

    Metadata:

      handler_name    : VideoHandler

 

再准备一个音频文件yuganqingwuguan.mp3:

./ffprobe.exe /cygdrive/h/yuganqingwuguan.mp3

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

[mp3 @ 0x2001a200] Skipping 0 bytes of junk at 256.

[mp3 @ 0x2001a200] Estimating duration from bitrate, this may be inaccurate

Input #0, mp3, from '/cygdrive/h/yuganqingwuguan.mp3':

  Metadata:

    title           : ▒▒▒▒▒▒޹▒

    artist          : ▒▒ǧɺ

    genre           : Other

  Duration: 00:02:23.84, start: 0.000000, bitrate: 128 kb/s

    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s

 

合成:

./ffmpeg  -ss 0 -t 144 -i /cygdrive/h/IMG_0024-audio.mp4 -i /cygdrive/h/yuganqingwuguan.mp3 -strict -2 -vcodec copy /cygdrive/h/IMG_0024+yuganqingwuguan.mp3.mp4

 

这里视频文件IMG_0024-audio.mp4只有视频流,时长3分钟(180秒),音频文件yuganqingwuguan.mp3时长2分24秒(144秒)。所以在合成的时候只合成视频文件的前2分24秒(144秒)。

 

合成后的视频文件:

./ffprobe.exe /cygdrive/h/IMG_0024+yuganqingwuguan.mp3.mp4

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/cygdrive/h/IMG_0024+yuganqingwuguan.mp3.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2avc1mp41

    encoder         : Lavf56.36.100

  Duration: 00:02:24.17, start: 0.023220, bitrate: 850 kb/s

    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 320x568, 713 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 23976 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

 

 

视频抓图

./ffmpeg -i /cygdrive/h/IMG_0024.mp4 -f image2 -vf fps=fps=1 /cygdrive/h/IMG_0024/out%d.png

 

ffmpeg version 2.7.2 Copyright (c) 2000-2015 the FFmpeg developers

  built with gcc 4.5.3 (GCC)

  configuration: --enable-shared --prefix=/usr/local/ffmpeg

  libavutil      54. 27.100 / 54. 27.100

  libavcodec     56. 41.100 / 56. 41.100

  libavformat    56. 36.100 / 56. 36.100

  libavdevice    56.  4.100 / 56.  4.100

  libavfilter     5. 16.101 /  5. 16.101

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  2.100 /  1.  2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/cygdrive/h/IMG_0024.mp4':

  Metadata:

    major_brand     : mp42

    minor_version   : 1

    compatible_brands: isommp41mp42

    creation_time   : 2020-08-25 17:54:46

  Duration: 00:03:00.05, start: 0.000000, bitrate: 836 kb/s

    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)

    Metadata:

      creation_time   : 2020-08-25 17:54:46

      handler_name    : Core Media Audio

    Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 320x568, 706 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 23976 tbc (default)

    Metadata:

      creation_time   : 2020-08-25 17:54:46

      handler_name    : Core Media Video

Output #0, image2, to '/cygdrive/h/IMG_0024/out%d.png':

  Metadata:

    major_brand     : mp42

    minor_version   : 1

    compatible_brands: isommp41mp42

    encoder         : Lavf56.36.100

    Stream #0:0(und): Video: png, rgb24, 320x568, q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc (default)

    Metadata:

      creation_time   : 2020-08-25 17:54:46

      handler_name    : Core Media Video

      encoder         : Lavc56.41.100 png

Stream mapping:

  Stream #0:1 -> #0:0 (h264 (native) -> png (native))

Press [q] to stop, [?] for help

frame=  181 fps=1.0 q=0.0 Lsize=N/A time=00:03:01.00 bitrate=N/A

video:66941kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

 

0
0
分享到:
评论

相关推荐

    FFMPEG: Download failed: 6;"Couldn't resolve host name"

    FFmpeg 是一个强大的开源项目,包含了众多用于处理音视频...通过手动干预和调试,我们可以确保OpenCV成功地集成FFmpeg,从而实现视频处理功能。在实际开发中,理解和处理这类问题对于提升工作效率和项目质量至关重要。

    C# ffmpeg 处理视频、C# ffmpeg播放视频

    本篇将深入探讨如何在C#环境下利用FFmpeg进行视频处理以及播放视频。 首先,`C# ffmpeg.autogen`是指将FFmpeg的C语言接口自动生成为C#可用的接口,以便于在C#项目中调用FFmpeg的功能。由于C#原生并不支持FFmpeg的...

    ffmpeg java 视频处理

    在Java开发中,我们可以通过调用FFmpeg的命令行接口来实现视频处理功能。这个"ffmpeg java 视频处理"的项目或教程可能是为了演示如何在Java应用中集成FFmpeg,以进行视频的剪辑、转码、合并、添加水印等操作。 1. *...

    FFmpeg4Android:视频播放

    FFmpeg4Android是一个专为Android平台设计的视频处理框架,其核心是FFmpeg库,一个强大的开源多媒体处理工具。FFmpeg支持多种视频和音频格式,包括编码、解码、转换、流媒体等操作,广泛应用于视频播放、编辑、转换...

    C++ 视频处理 2G9章视频教程 FFmpeg音视频核心技术精讲与实战.zip

    FFmpeg 是一个强大的开源项目,用于音视频处理,包括编码、解码、转换、流处理等。本教程“C++ 视频处理 2G9章视频教程 FFmpeg音视频核心技术精讲与实战”深入浅出地介绍了如何利用C++语言结合FFmpeg库进行音视频的...

    ffmpeg音视频处理工具

    非常强大的图片音视频处理工具,支持CMD运行,包含dll一起。指令可以网上找,非常简单实用的工具ffmpeg新版

    ffmpeg视频处理下载

    压缩包中的"ffmpeg-3.4.2-win64-static"包含了预编译的FFmpeg Windows静态版本,这意味着用户无需额外安装依赖库,可以直接运行提供的可执行文件进行视频处理操作。 总之,FFmpeg是一个功能强大的多媒体处理工具,...

    ffmpeg实现的视频分割

    2. FFmpeg视频分割命令行操作: 使用FFmpeg进行视频分割,通常会使用`-ss`参数指定开始时间,`-t`参数指定持续时间,以及`-i`参数指定输入视频文件。例如,分割视频从第30秒开始,持续60秒的命令为: ``` ffmpeg ...

    ffmpeg-20181107-0c6d4e7-win64-shared.zip

    ffmpeg最新(2018.11.07)编译出的可执行程序,解压即可运行。 附上使用说明: 1. 下载好对应的包后解压出来,在对应的bin文件夹通过:“Shift + 鼠标右键” 的方式用 “在此处打开PowerShell窗口” 打开PS窗口 我的...

    ffmpeg_version.cmake,opencv_videoio_ffmpeg.dll opencv_videoio_ffmepg_64.dll

    在这个案例中,"ffmpeg_version.cmake"确保了OpenCV在编译时正确地链接到FFmpeg库,以便利用其视频处理功能。 "opencv_videoio_ffmpeg.dll"和"opencv_videoio_ffmpeg_64.dll"是动态链接库文件,它们包含了OpenCV的...

    c#基于FFMPEG的视频转码(视频转音频)

    在IT行业中,FFMPEG是一个强大的开源工具,用于处理音视频文件,包括转换、编码、解码、流处理等操作。本项目是基于C#语言的FFMPEG库实现的视频转码功能,特别是将视频文件转换为音频文件。下面我们将深入探讨FFMPEG...

    FFMPEG:4.4.2安卓SO动态库+neon解码64位

    FFmpeg是一个开源项目,用于...通过NDK编译的动态库和头文件,开发者可以轻松地将FFmpeg的功能整合到自己的Android应用中,实现各种音视频处理需求。对于需要处理大量多媒体内容的应用来说,这是非常重要的技术资源。

    ffmpeg实现视频切割

    FFmpeg是一款强大的开源多媒体处理工具,它包含了各种用于音频和视频处理的功能,如转换、编码、解码、封装、过滤和流媒体等。在本文中,我们将深入探讨如何使用FFmpeg进行视频切割,以及为什么从关键帧开始切割是...

    利用ffmpeg视频转换处理

    在Java开发中,我们可以利用FFmpeg的命令行接口或者相关的Java库来实现各种视频处理功能,如视频格式转换、视频转GIF等。本篇文章将深入探讨如何在Java环境中利用FFmpeg进行视频转换处理。 1. **FFmpeg的安装与配置...

    ffmpeg:win10 64位 Static版

    FFmpeg 是一个强大的开源跨平台命令行工具套件,用于处理多媒体文件,包括音频、视频、图像和字幕。在Windows 10 64位系统中,使用Static版本的FFmpeg可以确保程序独立于系统库运行,无需依赖额外的DLL文件。"ffmpeg...

    FFMPEG:4.4.2安卓SO动态库+neon解码32位

    FFmpeg是一款开源的跨平台多媒体处理工具,广泛用于音频...总之,这个FFmpeg 4.4.2的32位armv7-a版本,结合了NDK和neon优化,为32位Android设备提供了高效的视频处理能力,是开发者在创建多媒体应用时的一个强大工具。

    FFmpeg 从入门到精通

    2. 流媒体处理:FFmpeg 可以处理流媒体,实现流媒体的实时处理和传输。 3. 音视频编辑:FFmpeg 可以用于音视频编辑,实现音视频的裁剪、拼接、特效处理等。 FFmpeg 的使用方法: 1. 安装 FFmpeg:读者可以根据需要...

    winform利用ffmpeg给视频添加背景乐

    4. **创建过滤器图**: FFmpeg的过滤器系统可以用来处理音视频流,例如,我们可以创建一个“amix”过滤器,将多个音频流混合成一个。 5. **配置过滤器**: 设置过滤器参数,如音频混合的比例,然后连接输入流到过滤器...

    ffmpeg提取视频流

    通过其丰富的功能和灵活的API,开发者可以实现各种音视频处理任务。在处理视频流时,可以将其解码为图像序列,如PPM格式,用于进一步分析或与其他图像处理技术结合使用。而提供的开发资源则使得在项目中集成FFmpeg变...

    基于ffmpeg无损视频压缩软件

    压缩包内的`ffmpeg.exe`是FFmpeg的Windows可执行文件,可以直接运行进行视频处理。而`VideoZip.exe`可能是开发者编写的GUI界面程序,用于封装FFmpeg的功能,提供更友好的用户界面,使得非程序员也能轻松使用这些高级...

Global site tag (gtag.js) - Google Analytics