我已经阅读了许多其他类似问题的答案,但是它们都有其他(显然)我不理解的变量/并发症,因为我没有运气尝试将其应用于问题。
我正在尝试将没有音频的10秒免责声明视频(从png文件创建)添加到有音频的MP4视频中,并在将它们连接在一起时完全失去音频。
我正在做的是:
ffmpeg.exe -i MyDisclaimer.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp1.ts
ffmpeg.exe -i MyVideo.MP4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp2.ts
ffmpeg.exe -i "concat:temp1.ts|temp2.ts" -c copy -bsf:a aac_adtstoasc "final.mp4"
第2步会生成一个.ts文件,该文件确实有音频,但是第3步中的某些操作会忽略/删除最终输出中的音频。
在创建MyVideo.MP4时,我正在使用-acodec copy
来保持原始音频质量。如何在连接时完成同一件事,或者至少完全停止丢失它?
这是我的输出(删除了长路径),而FFMpeg版本位于底部。
C:>ffmpeg.exe -i MyDisclaimer.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp1.ts
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MyDisclaimer.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:00:10.01, start: 0.000000, bitrate: 57 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 53 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Output #0, mpegts, to 'temp1.ts':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080, q=2-31, 53 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 11988 tbc (default)
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 300 fps=0.0 q=-1.0 Lsize= 105kB time=00:00:09.90 bitrate= 86.5kbits/s
video:66kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 59.469032%
C:>ffmpeg.exe -i MyVideo.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp2.ts
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MyVideo.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : EXAMPLE-Testing upload 842
encoder : Lavf56.40.101
Duration: 00:00:24.73, start: 0.000000, bitrate: 1521 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1615:1616 DAR 1615:909], 1487 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (HE-AACv2) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 47 kb/s (default)
Metadata:
handler_name : SoundHandler
Output #0, mpegts, to 'temp2.ts':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1615:1616 DAR 1615:909], q=2-31, 1487 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 11988 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, 47 kb/s (default)
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= 731 fps=0.0 q=-1.0 Lsize= 5027kB time=00:00:24.42 bitrate=1685.8kbits/s
video:4429kB audio:143kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.950656%
C:>ffmpeg.exe -i "concat:temp1.ts|temp2.ts" -c copy -bsf:a aac_adtstoasc "Final.mp4"
[mpegts @ 00000000051362c0] Could not find codec parameters for stream 1 (Audio: aac ([15][0][0][0] / 0x000F), 0 channels): unspecified sample format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'concat:temp1.ts|temp2.ts':
Duration: 00:00:24.39, start: 1.466733, bitrate: 1723 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x101](und): Audio: aac ([15][0][0][0] / 0x000F), 0 channels
[mp4 @ 000000000573a020] Codec for stream 0 does not use global headers but container format requires global headers
Output #0, mp4, to 'Final.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, q=2-31, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 1031 fps=0.0 q=-1.0 Lsize= 4511kB time=00:00:34.30 bitrate=1077.4kbits/s
video:4500kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.239671%
FFMPEG VErsion Info
ffmpeg version N-73975-gda8b70b Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 28.100 / 54. 28.100
libavcodec 56. 52.100 / 56. 52.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 27.100 / 5. 27.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100