作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一组不同格式的视频片段,需要连接起来并作为单个视频上传到数据库。我需要以尽可能少的质量损失来做到这一点。例如,一组是:
video_1.mov - 796 frames, 432Mb,
video_2.mp4 - 913 frames, 58Mb,
video_3.mov - 625 frames, 345Mb
output.mov - 2334 frames, ?Mb
.mp4
至.mov
与 lossless encoding : ffmpeg -i video_2.mp4 -c:v libx264 -preset veryslow -crf 0 -c:a copy video_2.mov
[h264 @ 0x558298795760] error while decoding MB 110 37, bytestream -69483.1kbits/s speed=0.227x
[h264 @ 0x558298795760] concealing 3659 DC, 3659 AC, 3659 MV errors in P frame
video_2.mov - frames 913, 112Mb
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mov
mylist.txt
是:
file 'video_1.mov'
file 'video_2.mov'
file 'video_3.mov'
[concat @ 0x561cbae96900] Could not find codec parameters for stream 2 (Unknown: none): unknown codec.Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mov @ 0x555b5dca4f00] Non-monotonous DTS in output stream 0:1; previous: 1527575, current: 1168413; changing to 1527576. This may result in incorrect timestamps in the output file.
output.mov
这是
432+345+112=889Mb
的正确大小但只有
1421
帧数等于
video_1.mov - 796 frames
中的帧数和
video_3.mov - 625 frames
.当我播放连接版本时,
output.mov
,它会在
video_2.mov
的持续时间内卡住段,然后正常继续
video_3.mov
.
ffmpeg -n -i video_1.mov -i video_2.mp4 -i video_3.mov
根据产生的评论:
`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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video_1.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2019-11-16T09:57:04.000000Z
keywords : iMovie
description :
title :
com.apple.quicktime.description:
com.apple.quicktime.displayname:
com.apple.quicktime.keywords: iMovie
com.apple.quicktime.title:
Duration: 00:00:31.84, start: 0.000000, bitrate: 108530 kb/s
Stream #0:0(eng): Audio: pcm_s16be (lpcm / 0x6D63706C), 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
creation_time : 2019-11-16T09:57:04.000000Z
handler_name : Core Media Data Handler
Stream #0:1(und): Video: prores (apcn / 0x6E637061), yuv422p10le(bt709, progressive), 1920x1080, 106992 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
Metadata:
creation_time : 2019-11-16T09:57:04.000000Z
handler_name : Core Media Data Handler
encoder : Apple ProRes 422
timecode : 00:00:00:00
Stream #0:2(und): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2019-11-16T09:57:04.000000Z
handler_name : Core Media Data Handler
timecode : 00:00:00:00
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'video_2.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
creation_time : 2019-11-16T09:55:40.000000Z
Duration: 00:00:30.71, start: 0.000000, bitrate: 15320 kb/s
Stream #1:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 165 kb/s (default)
Metadata:
creation_time : 2019-11-16T09:55:40.000000Z
handler_name : Core Media Audio
Stream #1:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080, 15277 kb/s, 29.98 fps, 29.97 tbr, 90k tbn, 60 tbc (default)
Metadata:
creation_time : 2019-11-16T09:55:40.000000Z
handler_name : Core Media Video
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'video_3.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2019-11-16T09:57:19.000000Z
keywords : iMovie
description :
title :
com.apple.quicktime.description:
com.apple.quicktime.displayname:
com.apple.quicktime.keywords: iMovie
com.apple.quicktime.title:
Duration: 00:00:25.00, start: 0.000000, bitrate: 110329 kb/s
Stream #2:0(eng): Audio: pcm_s16be (lpcm / 0x6D63706C), 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
creation_time : 2019-11-16T09:57:19.000000Z
handler_name : Core Media Data Handler
Stream #2:1(und): Video: prores (apcn / 0x6E637061), yuv422p10le(bt709, progressive), 1920x1080, 108790 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
Metadata:
creation_time : 2019-11-16T09:57:19.000000Z
handler_name : Core Media Data Handler
encoder : Apple ProRes 422
timecode : 00:00:00:00
Stream #2:2(und): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2019-11-16T09:57:19.000000Z
handler_name : Core Media Data Handler
timecode : 00:00:00:00
最佳答案
要连接的所有输入必须具有相同的属性和格式。 video_2.mp4
奇怪的是 MP4 中的 H.264 + AAC,而其他的是 MOV 中的 ProRes + PCM。
一种选择是重新编码 video_2.mp4
匹配其他输入:
ffmpeg -i video_2.mp4 -map 0 -c:a pcm_s16be -c:v prores -r 25 -video_track_timescale 25 video_2.mov
mylist.txt
:
file 'video_1.mov'
file 'video_2.mov'
file 'video_3.mov'
ffmpeg -f concat -i mylist.txt -c copy output.mov
关于video - ffmpeg:以尽可能少的质量损失连接不同格式的视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62335472/
我知道在 KDB 中,如果您有一个列表,例如... l:`apples`oranges`pears` 您可以像下面这样进行 N 次随机选择: 9?l 但是如何尽可能均匀地选择列表中的每个项目? 最佳答
我真的厌倦了它。我有一个高级 Web 应用程序依赖于大量 Javascript 库(jQuery、jQueryUI、OpenLayers、highcharts、EJSChart 等等)。不用说,Int
我是一名优秀的程序员,十分优秀!