我搜索并找到了使用 mkvtoolnox 分割视频文件的方法,使得每个文件在此处具有相同的大小,但没有找到使每个文件具有相同持续时间(如 10 分钟)的方法。有什么办法吗?我的问题是关于 mkvtoolnix,而不是关于使用其他工具。我搜索,并找到了一些使用 ffmpeg 的其他方法:
我的系统:
Laptop Dell inspiron 15 3000
RAM: 16 GB
SSD 480 GB Kingston
Intel Core i3 7th Generation
OS: Ubuntu 18.04 with Software and System Updates
Web Browser: Mozilla Firefox, Google Chrome, Palemoon. All latest.
Terminal emulator: Yakuake, gnome-terminal.
Other Terminal: TTY1
Internet service provider connection speed: 100 Mbps (asymmetric)
升级
就在最近,我运行了 sudo apt upgrade 以便从终端升级我的软件。在此之前,一切都很好。我能够播放带有视频和音频的视频。并且 mkv 文件用于顺利运行,允许在文件中选择任何语言/字幕或任何其他选项。
收到的错误
我mpv
用来播放我的 mkv 和其他格式的文件,如 ogv、mpg、mpeg2、mp4 等。
升级系统中的所有软件后,我开始使用这种屏幕而不是视频本身。
其他视频播放器也有类似的行为,几秒钟后变得无响应并引发高处理器负载,但似乎他们正在寻找编解码器、插件或其他东西以做好工作,但他们没有达到。
播放器
似乎是我可以播放此视频的唯一方法,但存在一些错误,例如错误的视频持续时间。
geppettvs@DM4:~/Peliculas$ mplayer BIRDS\ OF\ PREY.2020.WEB-DL.1080P-Ignacio\ Hd.mkv
MPlayer 1.3.0 (Debian), built with gcc-7 (C) 2000-2016 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing BIRDS OF PREY.2020.WEB-DL.1080P-Ignacio Hd.mkv.
libavformat version 57.83.100 (external)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0, Ignacio Hd
[lavf] stream 1: audio (ac3), -aid 0, -alang spa, Ignacio Hd
[lavf] stream 2: audio (ac3), -aid 1, -alang eng, Ignacio Hd
[lavf] stream 3: subtitle (srt), -sid 0, -slang spa, Ignacio Hd
[lavf] stream 4: video (mjpeg), -vid 1
[lavf] stream 5: video (mjpeg), -vid 2
VIDEO: [H264] 1920x802 0bpp 23.976 fps 0.0 kbps ( 0.0 kbyte/s)
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 57.107.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:
title: Aves de Presa (y la Fantabulosa Emancipación de Harley Quinn) (2020) Latino HD WEB-DL 1080P - LatinoMegaHD
encoder: libebml v1.3.0 + libmatroska v1.4.1
creation_time: 2020-03-24T06:43:53.000000Z
Load subtitles in ./
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, floatle, 256.0 kbit/8.33% (ratio: 32000->384000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
AO: [pulse] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
Movie-Aspect is 2.39:1 - prescaling to correct movie aspect.
VO: [xv] 1920x802 => 1920x802 Planar YV12
A: 9.8 V: 9.8 A-V: 0.000 ct: 0.042 0/ 0 38% 1% 0.7% 0 0
Exiting... (Quit)
[mié mar 25 08:08:44 CST 2020] geppettvs@DM4:~/Peliculas$ mplayer BIRDS\ OF\ PREY.2020.WEB-DL.1080P-Ignacio\ Hd.mkv
MPlayer 1.3.0 (Debian), built with gcc-7 (C) 2000-2016 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing BIRDS OF PREY.2020.WEB-DL.1080P-Ignacio Hd.mkv.
libavformat version 57.83.100 (external)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0, Ignacio Hd
[lavf] stream 1: audio (ac3), -aid 0, -alang spa, Ignacio Hd
[lavf] stream 2: audio (ac3), -aid 1, -alang eng, Ignacio Hd
[lavf] stream 3: subtitle (srt), -sid 0, -slang spa, Ignacio Hd
[lavf] stream 4: video (mjpeg), -vid 1
[lavf] stream 5: video (mjpeg), -vid 2
VIDEO: [H264] 1920x802 0bpp 23.976 fps 0.0 kbps ( 0.0 kbyte/s)
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 57.107.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:
title: Aves de Presa (y la Fantabulosa Emancipación de Harley Quinn) (2020) Latino HD WEB-DL 1080P - LatinoMegaHD
encoder: libebml v1.3.0 + libmatroska v1.4.1
creation_time: 2020-03-24T06:43:53.000000Z
Load subtitles in ./
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, floatle, 256.0 kbit/8.33% (ratio: 32000->384000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
AO: [pulse] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
Movie-Aspect is 2.39:1 - prescaling to correct movie aspect.
VO: [xv] 1920x802 => 1920x802 Planar YV12
A: 15.5 V: 15.5 A-V: 0.000 ct: 0.042 0/ 0 36% 1% 0.6% 0 0
Exiting... (Quit)
mpv
mpv信息
mpv 0.27.2 (C) 2000-2017 mpv/MPlayer/mplayer2 projects
built on UNKNOWN
ffmpeg library versions:
libavutil 55.78.100
libavcodec 57.107.100
libavformat 57.83.100
libswscale 4.8.100
libavfilter 6.107.100
libswresample 2.9.100
ffmpeg version: 3.4.6-0ubuntu0.18.04.
播放器
这是smplayer
同一个视频,您会注意到一些奇怪的伪影而不是视频。
播放器信息
This is SMPlayer v. 19.10.2 (revision 9245) running on Linux
vlc
VLC 显示黑屏和从左到右的一条线,例如搜索正确的视频编解码器或其他东西,几秒钟后变得无响应。
vlc信息
VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7)
VLC version 3.0.8 Vetinari (3.0.8-0-gf350b6b5a7)
Compiled by buildd on lcy01-amd64-014.buildd (Sep 11 2019 11:39:37)
Compiler: gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public License;
see the file named COPYING for details.
Written by the VideoLAN team; see the AUTHORS file.
用于测试的其他视频软件信息和播放器
ffmpeg
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
言语
Parole Media Player 1.0.1
图腾
totem 3.26.0
libvdpau-va-gl1
正如@nobody 所问,我检查libvdpau-va-gl1
了我的系统中是否安装了它,结果我没有它。
安装后,我尝试打开视频文件,导致布局更干净,但到目前为止还没有完整的视频。
非常感谢您愿意提供帮助。
dpkg -l | grep gstreamer
geppettvs@DM4:~$ dpkg -l | grep gstreamer
ii gir1.2-gstreamer-1.0:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GObject introspection data for the GStreamer library
ii gstreamer-qapt 3.0.4-0ubuntu1 amd64 GStreamer plugin to install codecs using QApt
ii gstreamer1.0-adapter-pulseeffects:amd64 4.7.2-3~bionic2 amd64 Gstreamer adapter
ii gstreamer1.0-alsa:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer plugin for ALSA
ii gstreamer1.0-autogain-pulseeffects:amd64 4.7.2-3~bionic2 amd64 Gstreamer crystalizer
ii gstreamer1.0-clutter-3.0:amd64 3.0.26-1 amd64 Clutter PLugin for GStreamer 1.0
ii gstreamer1.0-convolver-pulseeffects:amd64 4.7.2-3~bionic2 amd64 Gstreamer convolver
ii gstreamer1.0-crystalizer-pulseeffects:amd64 4.7.2-3~bionic2 amd64 Gstreamer crystalizer
ii gstreamer1.0-fluendo-mp3:amd64 0.10.32.debian-1 amd64 Fluendo mp3 decoder GStreamer 1.0 plugin
ii gstreamer1.0-gl:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer plugins for GL
ii gstreamer1.0-gtk3:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer plugin for GTK+3
ii gstreamer1.0-libav:amd64 1.14.5-0ubuntu1~18.04.1 amd64 libav plugin for GStreamer
ii gstreamer1.0-nice:amd64 0.1.14-1 amd64 ICE library (GStreamer plugin)
ii gstreamer1.0-packagekit 1.1.9-1ubuntu2.18.04.5 amd64 GStreamer plugin to install codecs using PackageKit
ii gstreamer1.0-plugins-bad:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer plugins from the "bad" set
ii gstreamer1.0-plugins-base:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer plugins from the "base" set
ii gstreamer1.0-plugins-base:i386 1.14.5-0ubuntu1~18.04.1 i386 GStreamer plugins from the "base" set
ii gstreamer1.0-plugins-base-apps 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer helper programs from the "base" set
ii gstreamer1.0-plugins-good:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer plugins from the "good" set
ii gstreamer1.0-plugins-ugly:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer plugins from the "ugly" set
ii gstreamer1.0-pulseaudio:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer plugin for PulseAudio
ii gstreamer1.0-tools 1.14.5-0ubuntu1~18.04.1 amd64 Tools for use with GStreamer
ii gstreamer1.0-x:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer plugins for X11 and Pango
ii libgstreamer-gl1.0-0:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer GL libraries
ii libgstreamer-plugins-bad1.0-0:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer libraries from the "bad" set
ii libgstreamer-plugins-base1.0-0:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer libraries from the "base" set
ii libgstreamer-plugins-base1.0-0:i386 1.14.5-0ubuntu1~18.04.1 i386 GStreamer libraries from the "base" set
ii libgstreamer-plugins-good1.0-0:amd64 1.14.5-0ubuntu1~18.04.1 amd64 GStreamer development files for libraries from the "good" set
ii libgstreamer1.0-0:amd64 1.14.5-0ubuntu1~18.04.1 amd64 Core GStreamer libraries and elements
ii libgstreamer1.0-0:i386 1.14.5-0ubuntu1~18.04.1 i386 Core GStreamer libraries and elements
ii libreoffice-avmedia-backend-gstreamer 1:6.0.7-0ubuntu0.18.04.10 amd64 GStreamer backend for LibreOffice
ii phonon-backend-gstreamer:amd64 4:4.9.0-1 amd64 Phonon GStreamer 1.0 backend
ii phonon-backend-gstreamer-common:amd64 4:4.9.0-1 amd64 Phonon GStreamer 1.0.x backend icons
ii phonon4qt5-backend-gstreamer:amd64 4:4.9.0-1 amd64 Phonon Qt5 GStreamer 1.0 backend
我在这里看到(如何无损地将 .ts 文件转换为主流格式?)为此目的推荐 MKV(ffmpeg -i input -map 0 -c copy output.mkv
),但不推荐 MP4,据说它涉及重新编码视频。
(基于此,我sh -c 'ffmpeg -i "$0" -map 0 -c copy "${0%%.*}".mkv' %f
在上下文菜单操作中使用,如此处所述。)
在这里(如何将 .mkv 文件无损地转换为 .mp4 文件?)我看到无需重新编码即可将 MKV 转换为 MP4 非常容易(ffmpeg -i input.mkv -codec copy output.mp4
),只需更改容器即可。
如果 TS->MKV->MP4 转换-无需重新编码是可能的,那么 TS->MP4 不应该直接也可以吗?
我已将命令添加到我的文件管理器上下文菜单中,sh -c 'ffmpeg -i "$0" -map 0 -c copy "${0%%.*}".mp4' %f
并且它对 .ts 文件的工作没有问题,就像对 .mkv 一样。
使用 Mediainfo 检查两个生成的 MP4 文件(TS->MP4
和TS->MKV->MP4
,前面提到的命令在哪里->
),我看到有关其视频内容的基本相同信息。
其余的都是一样的:
编码设置:cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0x3 / me=dia / subme=3 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=8 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min =25 / scenecut=40 / intra_refresh=0 / rc_lookahead=0 / rc=crf / mbtree=0 / crf=24.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / vbv_maxrate=3000 / vbv_bufsize=3000 /crf_max=0.0/nal_hrd=none/filler=0/ip_ratio=0.71/pb_ratio=1.30/aq=1:1.00
MKVToolnix 开发人员停止为 Ubuntu 16.04 提供 repo。现在他支持的最小 Ubuntu 版本是 18.04
有人能告诉我如何在不自己编译的情况下将最新版本(现在是 40.0)安装到 Ubuntu 16.04 吗?
我在一个文件夹中有几个视频;
~/Downloads/movie1.mkv
~/Downloads/movie2.mkv
~/Downloads/movie3.mkv
我想提取每个文件的比特率,并将数据输出到单个文本文件或输出列表中,我可以将其复制并粘贴到文本文件中。
我已经安装了ffmpeg。
因此,例如,的输出ffmpeg -i movie1.mkv
是;
Metadata:
encoder : libebml v1.2.0 + libmatroska v1.1.0
creation_time : 2011-04-09T18:18:05.000000Z
Duration: 00:04:27.71, start: 0.000000, bitrate: 10698 kb/s
Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1038, SAR 1:1 DAR 320:173, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Metadata:
title : movie1
Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
Metadata:
title : DTS-ES 5.1 @ 1509 Kbps
Stream #0:2(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
Metadata:
title : Commentary
Stream #0:3(eng): Subtitle: subrip
Stream #0:4(eng): Subtitle: subrip
“比特率:10698 kb/s”是我在这里追求的关键部分。
让我们假设所有三部电影都具有相同的比特率。
我想从所有三个视频中提取比特率信息,并将它们输出为;
movie1.mkv 10698
movie2.mkv 10698
movie3.mkv 10698
我将如何批量提取和输出这些信息?
我一直在尝试按文件名、ffmpeg 查找的组合,然后 | 到 grep。例如;find . -name "*.mkv" -exec ffmpeg -i "${1%.mkv}" | grep "bitrate:"
当前的尝试;
命令
ffmpeg -i movie1.mkv 2>&1 | grep bitrate | sed 's/bitrate: \(.*\), kb/\1/g'
返回
时长:00:04:27.71,开始:0.000000,比特率:10698 kb/s
命令
find . -name "*.mkv" -exec ffprobe -v error -show_entries format=bit_rate -of default=noprint_wrappers=1:nokey=1 "${~/Downloads/1%.mkv}" ';`'
返回
~/Downloads/1%.mkv:没有这样的文件或目录 ~/Downloads/1%.mkv:没有这样的文件或目录 ~/Downloads/1%.mkv:没有这样的文件或目录
我觉得我在这里很近,只是 find 有问题,并将 find 的输出召回到 ffprobe 中。
我试图让 FFmpeg 遍历我运行命令的路径下的所有文件和子文件夹,以将任何 MKV 文件转换为 MP4 容器。
我已经让下面的命令工作了,但是除了新的 MP4 扩展名之外,创建的新 MP4 文件仍然具有 MKV 扩展名。
find ./ -iname '*.avi' -o -iname '*.mkv' -exec bash -c 'ffmpeg -i "{}" -vcodec copy -acodec copy "{}".mp4' \;
例如 :
abcd.mkv (original file)
abcd.mkv.mp4 (new file)
如何调整命令以摆脱原始文件扩展名?
我对多媒体很陌生,我正在尝试找到一种制作漂亮截屏的方法,我已经能够使用 ffmpeg 捕获我的桌面:
$ ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 -y out.mkv
它工作得很好,但我想在后台添加音乐,如果我用 mencoder 添加它:
mencoder -ovc copy -oac mix -audiofile track.mp3 out.mkv -o out.mp4
它删除了视频声音,我不想替换它,我想在我的解释中添加音乐,有什么想法吗?