我有一个电视剧集视频(让我们说episode.mp4)。我还有一个简短的,20秒的结束信用视频,我想附加到各集(让我们说是闭幕.mp4)剧集和收盘总是Mp4,h264。框架尺寸也相同。但音频编解码器确实有所不同。我想使用concat demuxer连接以避免重新编码。我试过这样做,但它给了我一个错误。我想对短剪辑剪辑进行任何必要的编码更改(因此我将创建多个关闭文件,每个文件都匹配我要添加到的主要剧集文件)。我还需要什么来确保与两个视频匹配才能使用concat demuxer?如何编辑结束剪辑以匹配剧集?
以下是结束剪辑的探测:
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1001/48000
codec_tag_string=avc1
codec_tag=0x31637661
width=1280
height=720
coded_width=1280
coded_height=720
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=31
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=1/24000
start_pts=0
start_time=0.000000
duration_ts=672672
duration=28.028000
bit_rate=442973
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=672
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:handler_name=VideoHandler
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/48000
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=1344000
duration=28.000000
bit_rate=128651
max_bit_rate=128651
bits_per_raw_sample=N/A
nb_frames=1314
nb_read_frames=N/A
nb_read_packets=N/A
以下是一个样本集的探测:
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=208879/10016000
codec_tag_string=avc1
codec_tag=0x31637661
width=1280
height=718
coded_width=1280
coded_height=718
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=640:359
pix_fmt=yuv420p
level=31
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=5008000/208879
time_base=1/16000
start_pts=0
start_time=0.000000
duration_ts=40104768
duration=2506.548000
bit_rate=1092383
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=60096
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=und
TAG:handler_name=VideoHandler
[/STREAM]
[STREAM]
index=1
codec_name=ac3
codec_long_name=ATSC A/52A (AC-3)
profile=unknown
codec_type=audio
codec_time_base=1/48000
codec_tag_string=ac-3
codec_tag=0x332d6361
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
dmix_mode=-1
ltrt_cmixlev=-1.000000
ltrt_surmixlev=-1.000000
loro_cmixlev=-1.000000
loro_surmixlev=-1.000000
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=120313200
duration=2506.525000
bit_rate=192000
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=78329
nb_read_frames=N/A
nb_read_packets=N/A
最后,我正在运行Windows 10,这是对我的设置的探测:
ffprobe version N-87327-g18821e3 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 75.100 / 55. 75.100
libavcodec 57.106.101 / 57.106.101
libavformat 57. 82.100 / 57. 82.100
libavdevice 57. 8.101 / 57. 8.101
libavfilter 6.105.100 / 6.105.100
libswscale 4. 7.103 / 4. 7.103
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
我使用与剧集相同的屏幕尺寸和音频编解码器创建了一个结尾版本。但是,当我尝试连续时,产生的视频要比它应该的时间长(1:03:00)(大约42分钟),并且在播放时会冻结。这是concat:
ffmpeg -f concat -safe 0 -i "concat.txt" -c copy 's04e06.mp4'
ffmpeg : ffmpeg version N-87327-g18821e3 Copyright (c) 2000-2017 the FFmpeg developers
At line:1 char:1
+ ffmpeg -f concat -safe 0 -i "concat.txt" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (ffmpeg version ...mpeg developers:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2
--enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libxml2
--enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 75.100 / 55. 75.100
libavcodec 57.106.101 / 57.106.101
libavformat 57. 82.100 / 57. 82.100
libavdevice 57. 8.101 / 57. 8.101
libavfilter 6.105.100 / 6.105.100
libswscale 4. 7.103 / 4. 7.103
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000047cb020]
Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'concat.txt':
Duration: N/A, start: -0.002333, bitrate: 1284 kb/s
Stream #0:
0(und
): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x718 [SAR 1:1 DAR 640:359], 1092 kb/s
,
23.98 fps,
23.98 tbr,
16k tbn, 47.95 tb
c
Metadata:
handler_name :
VideoHandler
Stream #0:
1(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 192 kb/s
Metadata:
handler_name :
SoundHandler
[mp4 @ 0000000004daf380]
track 1: codec frame size is not set
Output #0, mp4, to 's04e06.mp4':
Metadata:
encoder :
Lavf57.82.10
0
Stream #0:
0
(und)
: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x718 [SAR 1:1 DAR 640:359], q=2-31, 1092 kb/s
,
23.98 fps, 23.98 tbr,
16k tbn,
16k tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 192 kb/s
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 3050 fps=0.0 q=-1.0 size= 32768kB time=00:02:07.16 bitrate=2110.9kbits/s speed= 254x
frame= 7005 fps=6993 q=-1.0 size= 65536kB time=00:04:52.12 bitrate=1837.8kbits/s speed= 292x
frame=12638 fps=8414 q=-1.0 size= 99072kB time=00:08:47.04 bitrate=1539.9kbits/s speed= 351x
frame=17009 fps=8492 q=-1.0 size= 125440kB time=00:11:49.34 bitrate=1448.7kbits/s speed= 354x
frame=18981 fps=7413 q=-1.0 size= 136704kB time=00:13:11.61 bitrate=1414.7kbits/s speed= 309x
frame=20233 fps=6444 q=-1.0 size= 144896kB time=00:14:03.80 bitrate=1406.7kbits/s speed= 269x
frame=23615 fps=6421 q=-1.0 size= 165888kB time=00:16:24.89 bitrate=1379.8kbits/s speed= 268x
frame=25322 fps=6057 q=-1.0 size= 175360kB time=00:17:36.06 bitrate=1360.3kbits/s speed= 253x
frame=26957 fps=5759 q=-1.0 size= 184576kB time=00:18:44.25 bitrate=1344.9kbits/s speed= 240x
frame=31478 fps=6076 q=-1.0 size= 215040kB time=00:21:52.83 bitrate=1341.8kbits/s speed= 253x
frame=33517 fps=5900 q=-1.0 size= 235264kB time=00:23:17.88 bitrate=1378.7kbits/s speed= 246x
frame=34974 fps=5658 q=-1.0 size= 246272kB time=00:24:18.65 bitrate=1383.1kbits/s speed= 236x
frame=36987 fps=5437 q=-1.0 size= 259840kB time=00:25:42.59 bitrate=1379.9kbits/s speed= 227x
frame=37543 fps=5140 q=-1.0 size= 263168kB time=00:26:05.79 bitrate=1376.9kbits/s speed= 214x
frame=39203 fps=4982 q=-1.0 size= 273152kB time=00:27:15.04 bitrate=1368.6kbits/s speed= 208x
frame=45904 fps=5484 q=-1.0 size= 305408kB time=00:31:54.52 bitrate=1306.8kbits/s speed= 229x
frame=47996 fps=5410 q=-1.0 size= 318720kB time=00:33:21.75 bitrate=1304.3kbits/s speed= 226x
frame=50719 fps=5409 q=-1.0 size= 336128kB time=00:35:15.32 bitrate=1301.7kbits/s speed= 226x
frame=53508 fps=5409 q=-1.0 size= 354560kB time=00:37:11.65 bitrate=1301.5kbits/s speed= 226x
frame=57118 fps=5452 q=-1.0 size= 372736kB time=00:39:42.24 bitrate=1281.8kbits/s speed= 227x
frame=58440 fps=5324 q=-1.0 size= 382208kB time=00:40:37.35 bitrate=1284.6kbits/s speed= 222x
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000047d3640]
Auto-inserting h264_mp4toannexb bitstream filter
frame=60098 fps=5228 q=-1.0 size= 392960kB time=01:02:39.76 bitrate= 856.2kbits/s speed= 327x
frame=60746 fps=5031 q=-1.0 size= 393472kB time=01:03:20.30 bitrate= 848.2kbits/s speed= 315x
frame=60768 fps=4978 q=-1.0 Lsize= 397136kB time=01:03:21.67 bitrate= 855.8kbits/s speed= 311x
video:335753kB audio:59186kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.556209%