조정된 볼륨 비디오를 연결하는 데 문제가 있습니다.

조정된 볼륨 비디오를 연결하는 데 문제가 있습니다.

여러 개의 비디오 클립을 촬영하고 ffmpeg를 사용하여 볼륨을 조정한 다음 연결을 시도했습니다(ffmpeg 사용). 하지만 개별적으로 조정된 볼륨 클립 파일을 볼 수 있고 조정된 볼륨을 들을 수 있지만 연결된 최종 버전에는 비디오가 포함되어 있습니다. 하지만 오디오는 없습니다.

볼륨을 조정하는 데 사용하는 명령은 다음과 같습니다.

> ffmpeg -y -i "E:/_Videos/Test/snippet.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts "E:/_Videos/Test/snippet.ts"


> ffmpeg -y -i "E:/_Videos/Test/snippet.ts" -vol 409 -vcodec copy  "E:/_Videos/Test/snippet_v1.6.ts"

내가 concat을 사용하는 명령은 다음과 같습니다

> ffmpeg -y -progress progressinfo.dat -f concat -safe 0 -i "E:/_Videos/Test/concat.txt" -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black" "E:/_Videos/Test/_MERGED.mp4"

이에 대한 출력은 아래와 같지만 이와 유사한 오류가 여러 개 나열되어 있습니다.

[aac @ 00000284490f6580] More than one AAC RDB per ADTS frame is not implemented. 
Update your FFmpeg version to the newest one from Git. If the problem still occurs, 
it means that your file has a feature which has not been implemented.

[aac @ 00000284490f6580] channel element 3.11 is not allocated
Error while decoding stream #0:1: Invalid data found when processing input

전체 출력....

ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200523
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --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-libx

ml2 --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 --enable-libopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, concat, from 'E:/_Videos/Test/concat.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1(und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 136 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 00000284495c5c40] using SAR=1/1
[libx264 @ 00000284495c5c40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 00000284495c5c40] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 00000284495c5c40] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=9 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 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=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'E:/_Videos/Test/_MERGED.mp4':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.54.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc58.54.100 aac
[aac @ 00000284490f6580] More than one AAC RDB per ADTS frame is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[aac @ 00000284490f6580] channel element 3.11 is not allocated
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 00000284490f6580] channel element 3.11 is not allocated
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 00000284490f6580] channel element 3.11 is not allocated
.
.
.

볼륨을 조정하기 위해 여러 가지 다른 방법을 시도했고 버전 4.2.3과 최신 4.4.1에서 이 방법을 시도했지만 둘 다 동일한 오류로 인해 실패했습니다. (저는 윈도우 10을 사용하고 있습니다)

(볼륨을 조정하지 않고 원본 .ts 파일을 연결하면 괜찮습니다).

내가 뭘 잘못하고 있는 걸까요(다른 mp4와 다시 연결하기 전에 mp4의 볼륨을 어떻게 조정합니까?)

답변1

따라서 해결책(위의 설명에서 Rotem이 제공한 [로템에게 큰 감사])은 Rotem이 말한 대로인 것처럼 보이지만 사운드가 동기화되지 않도록 "-async 1"을 사용하는 것을 약간 추가하면 됩니다. 비디오.

내가 사용한 전체 명령 세트는 다음과 같습니다.

// process the first clip (from a 640x480 30frames/s video)....

// Pull out a snippet from clip1.mp4 (39.51 seconds to 43.701 seconds...
ffmpeg -y -i "E:/_Videos/Test/clip1.mp4" -ss 39.51 -to 43.701 -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black" "E:/_Videos/Test/tmp/f1.mp4" 2>&1

// Create synthetic video with stereo audio...
ffmpeg -y -f lavfi -i testsrc=size=192x108:rate=25 -f lavfi -i sine=frequency=400 -f lavfi -i sine=frequency=1000 -filter_complex "[1:a][2:a]amix=inputs=2" -vcodec libx264 -crf 17 -pix_fmt yuv420p -acodec aac -ar 44100 -t 10  "E:/_Videos/Test/tmp/f1.ts" 2>&1

// Execute conversion to TS
ffmpeg -y -i "E:/_Videos/Test/tmp/f1.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts  "E:/_Videos/Test/tmp/f1.ts" 2>&1

// Set the volume...
ffmpeg -y -i "E:/_Videos/Test/tmp/f1.ts" -vol 25 -vcodec copy -acodec aac -async 1  "E:/_Videos/Test/tmp/f1_v0.1.ts" 2>&1

 
// now do the same for the next clip (with no volume adjust)...
// (a 1280x720 25frames/s video)...
ffmpeg -y -i "E:/_Videos/Test/clip2.mp4" -ss 0 -to 5.05 -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black" "E:/_Videos/Test/tmp/f2.mp4" 2>&1
ffmpeg -y -f lavfi -i testsrc=size=192x108:rate=25 -f lavfi -i sine=frequency=400 -f lavfi -i sine=frequency=1000 -filter_complex "[1:a][2:a]amix=inputs=2" -vcodec libx264 -crf 17 -pix_fmt yuv420p -acodec aac -ar 44100 -t 10  "E:/_Videos/Test/tmp/f2.ts" 2>&1
ffmpeg -y -i "E:/_Videos/Test/tmp/f2.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts  "E:/_Videos/Test/tmp/f2.ts" 2>&1

 

// and the same for the next clip (with volume adjusted down)...
// (a 1280x720 25frames/s video)...
ffmpeg -y -i "E:/_Videos/Test/clip2.mp4" -ss 0 -to 5.05 -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black" "E:/_Videos/Test/tmp/f3.mp4" 2>&1
ffmpeg -y -f lavfi -i testsrc=size=192x108:rate=25 -f lavfi -i sine=frequency=400 -f lavfi -i sine=frequency=1000 -filter_complex "[1:a][2:a]amix=inputs=2" -vcodec libx264 -crf 17 -pix_fmt yuv420p -acodec aac -ar 44100 -t 10  "E:/_Videos/Test/tmp/f3.ts" 2>&1
ffmpeg -y -i "E:/_Videos/Test/tmp/f3.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts  "E:/_Videos/Test/tmp/f3.ts" 2>&1
ffmpeg -y -i "E:/_Videos/Test/tmp/f3.ts" -vol 76 -vcodec copy -acodec aac -async 1  "E:/_Videos/Test/tmp/f3_v0.3.ts" 2>&1

 

// and the same for the next clip (with volume adjusted up)...
// (a 1280x720 25frames/s video)...
ffmpeg -y -i "E:/_Videos/Test/clip2.mp4" -ss 0 -to 5.05 -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black" "E:/_Videos/Test/tmp/f4.mp4" 2>&1
ffmpeg -y -f lavfi -i testsrc=size=192x108:rate=25 -f lavfi -i sine=frequency=400 -f lavfi -i sine=frequency=1000 -filter_complex "[1:a][2:a]amix=inputs=2" -vcodec libx264 -crf 17 -pix_fmt yuv420p -acodec aac -ar 44100 -t 10  "E:/_Videos/Test/tmp/f4.ts" 2>&1
ffmpeg -y -i "E:/_Videos/Test/tmp/f4.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts  "E:/_Videos/Test/tmp/f4.ts" 2>&1
ffmpeg -y -i "E:/_Videos/Test/tmp/f4.ts" -vol 409 -vcodec copy -acodec aac -async 1  "E:/_Videos/Test/tmp/f4_v1.6.ts" 2>&1


// then create a concat.txt file with the following contents
file 'f1_v0.1.ts'
file 'f2.ts'
file 'f3_v0.3.ts'
file 'f4_v1.6.ts'


// concatenate the listed files into the final _MERGED.mp4 file.
ffmpeg -y -progress progressinfo.dat -f concat -safe 0 -i "E:/_Videos/Test/tmp/concat.txt" -vf  "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black"  "E:/_Videos/Test/_MERGED.mp4" 2>&1

(지금은 첫 번째 클립과 두 번째 클립 사이에 크로스 페이드를 수행하는 방법을 아는 사람이 없을 것 같은데요?)

감사해요

관련 정보