Я заметил, что аудиосигнал кровоточит из сцепленных видео, содержащих чередующиеся слайд-шоу и обычные видео.
Мои команды
ffmpeg -y -ss 00:00:04.391 -to 00:02:17.171 -i "test.MP4" -r 60 -c:v libx264 -af afade=t=in:ss=0:d=1,afade=t=out:st='00\:02\:11.780':d=1 25.mp4
ffmpeg -y -i 25.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts 25f.ts
ffmpeg -y -loop 1 -i "test.JPG" -t 2 -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -shortest -r 60 -c:v libx264 -c:a aac -pix_fmt yuv420p -vf scale=-2:1080,pad=width=1920:height=1080:x=240:y=0:color=black 26.mp4
ffmpeg -y -i 26.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts 26f.ts
ffmpeg -y -i "concat:25f.ts|26f.ts" -bsf:a aac_adtstoasc -movflags faststart -c copy "final.mp4"
Остальная часть звука теста. MP4 стекается в начало теста.JPG-покадровое слайд-шоу.
Я предположил, что причиной была другая частота кадров, но добавление -r 60
не решило проблему.
Также кажется, что видеоплеер интерпретирует окончательное видеокак набор отдельных видео, как всякий раз, когда появляется «новое» видео, оно слегка заикается и теряет частоту кадров.
Как объединить их без кровотечения и создать окончательное видео без заикания?
ffprobe -show_streams 25.mp4:
ffprobe version N-92246-gc2ac3b8e6a Copyright (c) 2007-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181017
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 19.101 / 56. 19.101
libavcodec 58. 33.102 / 58. 33.102
libavformat 58. 19.102 / 58. 19.102
libavdevice 58. 4.106 / 58. 4.106
libavfilter 7. 37.100 / 7. 37.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '25.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.19.102
Duration: 00:00:12.65, start: 0.000000, bitrate: 2040 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1215:1216 DAR 135:76], 1903 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
Metadata:
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandle
[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=1/120
codec_tag_string=avc1
codec_tag=0x31637661
width=1920
height=1080
coded_width=1920
coded_height=1088
has_b_frames=2
sample_aspect_ratio=1215:1216
display_aspect_ratio=135:76
pix_fmt=yuv420p
level=42
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=60/1
avg_frame_rate=60/1
time_base=1/15360
start_pts=0
start_time=0.000000
duration_ts=193792
duration=12.616667
bit_rate=1903528
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=757
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=VideoHandle
[/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=606192
duration=12.629000
bit_rate=128049
max_bit_rate=128049
bits_per_raw_sample=N/A
nb_frames=593
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=SoundHandle
[/STREAM]
ffprobe -show_streams 26.mp4:
ffprobe version N-92246-gc2ac3b8e6a Copyright (c) 2007-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181017
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 19.101 / 56. 19.101
libavcodec 58. 33.102 / 58. 33.102
libavformat 58. 19.102 / 58. 19.102
libavdevice 58. 4.106 / 58. 4.106
libavfilter 7. 37.100 / 7. 37.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '26.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.19.102
Duration: 00:00:03.95, start: 0.000000, bitrate: 1814 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2272x4608 [SAR 1:1 DAR 71:144], 1798 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 2 kb/s (default)
Metadata:
handler_name : SoundHandler
[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=1/120
codec_tag_string=avc1
codec_tag=0x31637661
width=2272
height=4608
coded_width=2272
coded_height=4608
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=71:144
pix_fmt=yuv420p
level=60
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=60/1
avg_frame_rate=60/1
time_base=1/15360
start_pts=0
start_time=0.000000
duration_ts=60672
duration=3.950000
bit_rate=1798815
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=237
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=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=44100
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/44100
start_pts=0
start_time=0.000000
duration_ts=132300
duration=3.000000
bit_rate=2124
max_bit_rate=128000
bits_per_raw_sample=N/A
nb_frames=131
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=SoundHandler
[/STREAM]