这是我在 Debian 测试中使用的 ffmpeg 版本 -
$ ffmpeg -version
ffmpeg version 4.4.1-2+b1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Debian 11.2.0-12)
configuration: --prefix=/usr --extra-version=2+b1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --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-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
这是我试图使用的命令 -
$ ffmpeg -ss 00:22:20 -t 60 -i 123.mkv 456.mkv
这来自从视频文件的特定部分提取/复制音频,可能吗?这是我多年前问过的。
我还看了一下FFMpeg :创建一个大约的视频剪辑。没有音频的视频持续时间未知的 10 秒- 但如果我尝试使用其中显示的时间戳,它会出错说 -
Invalid duration specification for ss: 00:22:20:0.0
我正在播放的媒体文件大约是 50 多分钟,我只想要 22:20 秒和一分钟后的一分钟文件。
ffmpeg 或它处理事物的方式发生了变化。我显然已经更改了文件名。尽管如此,这就是它显示文件的内容,就好像我把它放在 mkvinfo 下一样
$ mkvinfo 456.mkv
+ EBML head
|+ EBML version: 1
|+ EBML read version: 1
|+ Maximum EBML ID length: 4
|+ Maximum EBML size length: 8
|+ Document type: matroska
|+ Document type version: 4
|+ Document type read version: 2
+ Segment: size 6959454
|+ Seek head (subentries will be skipped)
|+ EBML void: size 81
|+ Segment information
| + Timestamp scale: 1000000
| + Title: 123
| + Multiplexing application: Lavf58.76.100
| + Writing application: Lavf58.76.100
| + Segment UID: 0x19 0xba 0x01 0xe0 0xed 0x6f 0x79 0xef 0xfb 0x9d 0xe6 0xcd 0x2b 0xad 0x2f 0x79
| + Duration: 00:23:54.905000000
|+ Tracks
| + Track
| + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
| + Track UID: 4989308985802999081
| + "Lacing" flag: 0
| + Name: abcd
| + Language: und
| + Codec ID: V_MPEG4/ISO/AVC
| + Track type: video
| + Default duration: 00:00:00.041708333 (23.976 frames/fields per second for a video track)
| + Video track
| + Pixel width: 1280
| + Pixel height: 720
| + Interlaced: 2
| + Video colour information
| + Horizontal chroma siting: 1
| + Vertical chroma siting: 2
| + Codec's private data: size 45 (H.264 profile: High @L3.1)
| + Track
| + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
| + Track UID: 5858605359486045911
| + "Lacing" flag: 0
| + Name: abcd
| + Language: eng
| + Codec ID: A_VORBIS
| + Track type: audio
| + Audio track
| + Channels: 2
| + Sampling frequency: 48000
| + Bit depth: 32
| + Codec's private data: size 3959
| + Track
| + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
| + Track UID: 6757137498994684877
| + "Lacing" flag: 0
| + Name: abcd
| + Language: eng
| + Codec ID: S_TEXT/ASS
| + Track type: subtitles
| + Codec's private data: size 576
|+ Tags
| + Tag
| + Targets
| + Simple
| + Name: COMMENT
| + String: abcd
| + Simple
| + Name: ENCODER
| + String: Lavf58.76.100
| + Tag
| + Targets
| + Track UID: 4989308985802999081
| + Simple
| + Name: BPS
| + String: 1050683
| + Simple
| + Name: BPS
| + Tag language: eng
| + String: 1050683
| + Simple
| + Name: DURATION
| + Tag language: eng
| + String: 00:47:01.110000000
| + Simple
| + Name: NUMBER_OF_FRAMES
| + String: 67639
| + Simple
| + Name: NUMBER_OF_FRAMES
| + Tag language: eng
| + String: 67639
| + Simple
| + Name: NUMBER_OF_BYTES
| + String: 370511729
| + Simple
| + Name: NUMBER_OF_BYTES
| + Tag language: eng
| + String: 370511729
| + Simple
| + Name: _STATISTICS_WRITING_APP
| + String: mkvmerge v13.0.0 ('The Juggler') 64bit
| + Simple
| + Name: _STATISTICS_WRITING_APP
| + Tag language: eng
| + String: mkvmerge v13.0.0 ('The Juggler') 64bit
| + Simple
| + Name: _STATISTICS_WRITING_DATE_UTC
| + String: 2018-09-20 14:51:30
| + Simple
| + Name: _STATISTICS_WRITING_DATE_UTC
| + Tag language: eng
| + String: 2018-09-20 14:51:30
| + Simple
| + Name: _STATISTICS_TAGS
| + String: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
| + Simple
| + Name: _STATISTICS_TAGS
| + Tag language: eng
| + String: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
| + Simple
| + Name: ENCODER
| + String: Lavc58.134.100 libx264
| + Simple
| + Name: DURATION
| + String: 00:01:00.022000000
| + Tag
| + Targets
| + Track UID: 5858605359486045911
| + Simple
| + Name: BPS
| + String: 640000
| + Simple
| + Name: BPS
| + Tag language: eng
| + String: 640000
| + Simple
| + Name: DURATION
| + Tag language: eng
| + String: 00:47:01.120000000
| + Simple
| + Name: NUMBER_OF_FRAMES
| + String: 88160
| + Simple
| + Name: NUMBER_OF_FRAMES
| + Tag language: eng
| + String: 88160
| + Simple
| + Name: NUMBER_OF_BYTES
| + String: 225689600
| + Simple
| + Name: NUMBER_OF_BYTES
| + Tag language: eng
| + String: 225689600
| + Simple
| + Name: _STATISTICS_WRITING_APP
| + String: mkvmerge v13.0.0 ('The Juggler') 64bit
| + Simple
| + Name: _STATISTICS_WRITING_APP
| + Tag language: eng
| + String: mkvmerge v13.0.0 ('The Juggler') 64bit
| + Simple
| + Name: _STATISTICS_WRITING_DATE_UTC
| + String: 2018-09-20 14:51:30
| + Simple
| + Name: _STATISTICS_WRITING_DATE_UTC
| + Tag language: eng
| + String: 2018-09-20 14:51:30
| + Simple
| + Name: _STATISTICS_TAGS
| + String: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
| + Simple
| + Name: _STATISTICS_TAGS
| + Tag language: eng
| + String: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
| + Simple
| + Name: ENCODER
| + String: Lavc58.134.100 libvorbis
| + Simple
| + Name: DURATION
| + String: 00:01:00.003000000
| + Tag
| + Targets
| + Track UID: 6757137498994684877
| + Simple
| + Name: BPS
| + String: 40
| + Simple
| + Name: BPS
| + Tag language: eng
| + String: 40
| + Simple
| + Name: DURATION
| + Tag language: eng
| + String: 00:46:08.244000000
| + Simple
| + Name: NUMBER_OF_FRAMES
| + String: 636
| + Simple
| + Name: NUMBER_OF_FRAMES
| + Tag language: eng
| + String: 636
| + Simple
| + Name: NUMBER_OF_BYTES
| + String: 14113
| + Simple
| + Name: NUMBER_OF_BYTES
| + Tag language: eng
| + String: 14113
| + Simple
| + Name: _STATISTICS_WRITING_APP
| + String: mkvmerge v13.0.0 ('The Juggler') 64bit
| + Simple
| + Name: _STATISTICS_WRITING_APP
| + Tag language: eng
| + String: mkvmerge v13.0.0 ('The Juggler') 64bit
| + Simple
| + Name: _STATISTICS_WRITING_DATE_UTC
| + String: 2018-09-20 14:51:30
| + Simple
| + Name: _STATISTICS_WRITING_DATE_UTC
| + Tag language: eng
| + String: 2018-09-20 14:51:30
| + Simple
| + Name: _STATISTICS_TAGS
| + String: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
| + Simple
| + Name: _STATISTICS_TAGS
| + Tag language: eng
| + String: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
| + Simple
| + Name: ENCODER
| + String: Lavc58.134.100 ssa
| + Simple
| + Name: DURATION
| + String: 00:23:54.905000000
|+ Cluster
现在我可以从上面推断出,ffmpeg 只是剪切了视频,因此显示了旧版本的属性,包括时间,尽管我创建的媒体文件大约是一分钟。
反正有没有做得更好,这意味着它从今天开始使用 ffmpeg 版本并给出相同的结果,持续时间也会更改为一分钟而不是它显示的 23 分钟?
FWIW,我当前系统中的 mkvmerge 是 -
$ mkvmerge --veion
mkvmerge v64.0.0 ('Willows') 64-bit
您发布的示例看起来不错,但错误消息表明
0.0
在您执行命令时,开始时间附加了一个额外的内容。这应该有效: