Debian
通過 ffmpeg 提取影片會給出不正確的持續時間
這是我在 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
您執行命令時在開始時間附加了一個額外的內容。這應該有效:ffmpeg -ss 00:22:20 -t 60 -i 123.mkv 456.mkv