ffmpeg -i part1.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part1.ts
ffmpeg -i part2.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part2.ts
cat part1.ts part2.ts > parts.ts
ffmpeg -y -i parts.ts -acodec copy -ar 44100 -ab 96k -coder ac -vbsf h264_mp4toannexb parts.mp4
[h264 @ 0x1012600]sps_id out of range
[h264 @ 0x1012600]non-existing SPS 0 referenced in buffering period
[h264 @ 0x1012600]sps_id out of range
[h264 @ 0x1012600]non-existing SPS 0 referenced in buffering period
[NULL @ 0x101d600]error, non monotone timestamps 13779431 >= 13779431kbits/s
av_interleaved_write_frame(): Error while opening file
이 같은 일이 절반 정도가 있는 것으로 생각하노라 너회가 can& 통해 인코딩입니다 makes me, concat 이츠 파일을 함께 2 개의 t # 39 와 할꺼이나 작동합니까.
FFmpeg 은 세 연결 방법:
<! - 모든 언어: 쉬 >.
ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv \
-filter_complex "[0:v] [0:a] [1:v] [1:a] [2:v] [2:a] concat=n=3:v=1:a=1 [v] [a]" \
-map "[v]" -map "[a]" output.mkv
이 방법에는 재 인코딩 수행합니다.
[concat 데모크세르] [3] # 2.
$ cat mylist.txt
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
$ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
(echo file 'first file.mp4' & echo file 'second file.mp4' )>list.txt
ffmpeg -safe 0 -f concat -i list.txt -c copy output.mp4
ffmpeg -i "concat:input1|input2" -codec copy output.mkv
이 방법은 대부분의 형식, MP4, 이러한 특성으로 인해 작동하지 않는 등 형식 및 연결 수행됨 상투적이고 이 방법으로.
의심스러운 경우 concat 시도하시겠습니까 데모크세르.
[2]: https://ffmpeg.org/ffmpeg-filters.html # concat
.Mp4 위한 파일 (어떤 난 얻은 DailyMotion.com: 50 분 tv 부품 등 3 명의 .mp4 비디오 파일을 다운로드 받을 수 있는 에피소드, 불과 3) Windows 7 있지 않으며, 다음 인턴이었을때를 효과적인 솔루션을 mediaagent 파일을 재인코딩.
파일 형식 (, , file1.mp4 file2.mp4 file3.mp4) 와 내가 renamed 부품 시험기관인 올바른 순서로 볼 수 있는 전체 tv 된다.
내가 만든 다음, 배치 파일 (콩카t.바트) 에서는 다음과 같은 간단한 내용:
:: Create File List
echo file file1.mp4 > mylist.txt
echo file file2.mp4 >> mylist.txt
echo file file3.mp4 >> mylist.txt
:: Concatenate Files
ffmpeg -f concat -i mylist.txt -c copy output.mp4
그대가 이 방법을 찾고 있었는데 많은 다시 입력할 필요 없이 현재 폴더의 모든 파일 specifying mp4, 배치 파일 대신 이 시도하시겠습니까 너회의 windows가 ( 합니다 옵션을 포함할 -safe 0을):
:: Create File List
for %%i in (*.mp4) do echo file '%%i'>> mylist.txt
:: Concatenate Files
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
이 기능은 Windows 7 에 대한 일괄 처리 파일. T , Don& # 39 에서 사용하기 때문에 시도하시겠습니까 명령줄의 때만 배치 파일!
ls Movie_Part_1.mp4 Movie_Part_2.mp4 | perl -ne 'print "file $_"' | ffmpeg -f concat -i - -c copy Movie_Joined.mp4
이 " ls"; 파일이 포함된 가입 이 " perl"; 파이프 붙여넣습니다 즉석 연결 파일을 만듭니다. I - " 이 "; ffmpeg 읽을 수 있다고 부품을 파이프
(참고 - 내 파일 아무런 공간 또는 이상한 물건을 그 - you& # 39, ll, 함께 하는 것이 적절한 쉘로 탈출이라니요 이렇게 하려면 " hard". 파일).
정확히 동일한 있지 않은 경우 (100%, 동일한 코텍이 동일한 해상도, 동일한 유형) 에 처음 그 중간 스트리밍합니다 MP4 파일을 관심용 트랜스 코드 합니다.
ffmpeg -i myfile1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp1.ts
ffmpeg -i myfile2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp2.ts
// now join
ffmpeg -i "concat:temp1.ts|temp2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
I was trying to .mp3 .m4a 파일 및 오디오 파일 하나의 '이' 3 '연결' ffmpeg 명령이 작동합니다.
입력 명령:
ffmpeg -i input1.mp3 -i input2.mp3 -i input3.mp3 -filter_complex concat=n=3:v=0:a=1 -f MOV -vn -y input.m4a
의미: ". - n = = = = 1" concat filter_complex 3 v 0 은, : < br>;
>. , 는 미디어 사용, concat function.< br> 연결 (연결) >. n 고말은 확인입니다 총 개수를 입력입니다 files.< br>; >. v 고말은 has video? 1 = 0 = no 비디오를 사용하여 map_layer video.< br>; >. a 고말은 has audio? 1 = 0 = no 사용하여 오디오, 컨테인먼트하는 audio.< br>; >. 고말은 인력용 -f 설정 파일 형식 (ffmpeg 사용 - 형식 ',' 지원되는 형식 모두 보려면) < br>; >. 고말은 비활성화합니다 -vn 비디오 (또한 '' 다시그것들을 오디오를 비활성화합니다 내장되어 있지 않으면 그들이성년에) < br>; >. 고말은 overwrite 출력 파일을 -y 경우 출력 파일이 이미 있습니다).
자세한 정보: h '전체' ffmpeg 사용 모든 옵션을 인쇄하십시오 포함한 모든 포맷하여 코텍이 특정 옵션, 매우 긴)
자세한 설명서를 연결 될 수 있는 다양한 방법을 ffmpeg 에서 늑대굴에서 여기서요.
[# 39, Concat filter& & # 39, ] 사용할 수 있습니다. [2] 의 빠른 연결.
It 는 재 인코딩. 이 옵션을 사용할 때 최상의 투입물 서로 다른 비디오 / 오디오 포맷.
ffmpeg -i input1.mp4 -i input2.webm \
-filter_complex "[0:v:0] [0:a:0] [1:v:0] [1:a:0] concat=n=2:v=1:a=1 [v] [a]" \
-map "[v]" -map "[a]" output.mp4
ffmpeg -i input1.mp4 -i input2.webm -i input3.mp4 \
-filter_complex "[0:v:0] [0:a:0] [1:v:0] [1:a:0] [2:v:0] [2:a:0] concat=n=3:v=1:a=1 [v] [a]" \
-map "[v]" -map "[a]" output.mp4
물론 이 방법은 여러 동일한 입력 파일 형식.
[2]: https://ffmpeg.org/ffmpeg-filters.html # concat
이 협력했습니다 가져다줄래요 (windows)
ffmpeg -i "concat:input1|input2" -codec copy output
예를 들어.
ffmpeg -i "concat:01.mp4|02.mp4" -codec copy output.mp4
< h2> Python< /h2>;;;
일부 파이썬 코드를 사용하여 많은 mp4 (설치 python 에서 함께 할 폴더에 있습니다 python.org, 복사, 붙여넣기 (mp4.py) 에서 이 제품을 cmd 파일로 저장하고 이 코드는 파이썬 (mp4.py) 에서 열린 불렀으매 실행하십시오 폴더에 있는 모든 mp4 폴더에 적립율은 연결)
<! - 언어: 파이썬 - >.
import glob
import os
stringa = ""
for f in glob.glob("*.mp4"):
stringa += f + "|"
os.system("ffmpeg -i \"concat:" + stringa + "\" -codec copy output.mp4")
버전 2 로 Python< /h3> h3> <;;;
내 게시물로의 내 블로그에 에서 발췌, this is how I do it 의 파이썬.
<! - 언어: 파이썬 - >.
import os
import glob
def concatenate():
stringa = "ffmpeg -i \"concat:"
elenco_video = glob.glob("*.mp4")
elenco_file_temp = []
for f in elenco_video:
file = "temp" + str(elenco_video.index(f) + 1) + ".ts"
os.system("ffmpeg -i " + f + " -c copy -bsf:v h264_mp4toannexb -f mpegts " + file)
elenco_file_temp.append(file)
print(elenco_file_temp)
for f in elenco_file_temp:
stringa += f
if elenco_file_temp.index(f) != len(elenco_file_temp)-1:
stringa += "|"
else:
stringa += "\" -c copy -bsf:a aac_adtstoasc output.mp4"
print(stringa)
os.system(stringa)
concatenate()
I found 파이프 작동자 작동하지 가져다줄래요 MP4s Mac 에 대한 여러 가지 옵션을 사용할 때 3 concat 수락됨 대답.
다음 한 줄 광고문 Mac (하이 시에라) 를 연결 없이 작업 중인 mp4s 중간 파일 생성 필요합니다.
f - 0 - 난 < ffmpeg '안전, concat (backup-to-disk ./*.mp4 의 f, # 39, & # 39$ PWD 못하며창조된 에코 ", 파일 / $ f& ";; c 복제본에 output.mp4 '완료)
#!/bin/bash
[ -e list.txt ] && rm list.txt
for f in *.mp4
do
echo "file $f" >> list.txt
done
ffmpeg -f concat -i list.txt -c copy joined-out.mp4 && rm list.txt
현재 폴더의 모든 파일 '에 이어' 이 'joined-out.mp4 *.mp4'
거친 mac.
가 합계 결과 filesize 정확한 내 60 테스트됨 파일. 모든 손실됩니다 안 됩니다. 바로 내가 필요한
이 문서에서. https://trac.ffmpeg.org/wiki/Concatenate
>. , MP4 파일 있으면 먼저 MPEG-2 트랜스포트 스트림 서피스를 트랜스코딩과 루슬레슬리 이러한 연결 될 수 있다. H. 264 함께 AAC 오디오, 비디오 및 다음 사용할 수 있습니다.
ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
이 모든 플랫폼에서 외곽진입 작동됨.
그래서 내가 필요한 사용할 수 있는 크로스 플랫폼 스크립트입니다 캡슐화됨 이 '와' ffmpeg fluent 지었지 다음 해결책:
const unlink = path =>
new Promise((resolve, reject) =>
fs.unlink(path, err => (err ? reject(err) : resolve()))
)
const createIntermediate = file =>
new Promise((resolve, reject) => {
const out = `${Math.random()
.toString(13)
.slice(2)}.ts`
ffmpeg(file)
.outputOptions('-c', 'copy', '-bsf:v', 'h264_mp4toannexb', '-f', 'mpegts')
.output(out)
.on('end', () => resolve(out))
.on('error', reject)
.run()
})
const concat = async (files, output) => {
const names = await Promise.all(files.map(createIntermediate))
const namesString = names.join('|')
await new Promise((resolve, reject) =>
ffmpeg(`concat:${namesString}`)
.outputOptions('-c', 'copy', '-bsf:a', 'aac_adtstoasc')
.output(output)
.on('end', resolve)
.on('error', reject)
.run()
)
names.map(unlink)
}
concat(['file1.mp4', 'file2.mp4', 'file3.mp4'], 'output.mp4').then(() =>
console.log('done!')
)
I made a, s # 39 로 연결할 슬라이드에서는 스크립트입니다 여러 GoPro mp4& 720p mp4. # 39 의 희망, it& 움말.
#!/bin/sh
cmd="( "
for i; do
cmd="${cmd}ffmpeg -i $i -ab 256000 -vb 10000000 -mbd rd -trellis 2 -cmp 2 -subcmp 2 -g 100 -f mpeg -; "
done
cmd="${cmd} ) | ffmpeg -i - -vb 10000000 -ab 256000 -s 1280x720 -y out-`date +%F-%H%M.%S`.mp4"
echo "${cmd}"
eval ${cmd}
'의' I found 작동하잖아 보다 빠르고 효과적으로 사용할 수 있는 오픈 소스 파일을 .mp4 명령줄 도구: 'mp4box'. 그럼 이런 식으로 쓸 수 있다.
mp4box.exe -add video1.mp4 -cat video2.mp4 destvideo.mp4
여기에 다운로드하십시오 대부분의 플랫폼: https://gpac.wp.imt.fr/mp4box/
내가 페르송널리 같은 외부 파일을 만들지 않을 수 있는 파일 포함) 는 다음과 같은 솔루션을 보유하고 있는, 그래서 그 삭제하시겠습니까 내 번호 목록 (,,, 'like' file_1_name file_2_name file_10_name file_20_name file_100_name.)
#!/bin/bash
filesList=""
for file in $(ls -1v *.mp4);do #lists even numbered file
filesList="${filesList}${file}|"
done
filesList=${filesList%?} # removes trailing pipe
ffmpeg -i "concat:$filesList" -c copy $(date +%Y%m%d_%H%M%S)_merged.mp4
윈도우 10 의 다양한 시도한 후 아래 스크립트입니다 가져다줄래요 협력했습니다 powershell.
$files=Get-ChildItem -path e:\ -Filter *.mp4
$files| ForEach-Object {"file '$($_.FullName)'"}| Out-File -FilePath e:\temp.txt -Encoding ASCII
if (-not (test-path "e:\ffmpeg\bin\ffmpeg.exe")) {throw "e:\ffmpeg\bin\ffmpeg.exe needed"}
E:\ffmpeg\bin\ffmpeg.exe -safe 0 -f concat -i "e:\temp.txt" -c copy -bsf:v hevc_mp4toannexb -an e:\joined.mp4
# Conversion Cleanup
Remove-Item e:\temp.txt
여기서 첫 두 줄은 트럼퍼트스트 디스크입니다. diskid 다음과 같은 내용을 텍스트 파일을 만듭니다
file 'e:\first.mp4'
file 'e:\second.mp4'
3rd, 4 선, joined.mp4" " 만듭다 http://math-atlas. sourceforge. 경로 및 ffmpeg 확인합니다.
주요 차이점은 아래와 같이 다른 대답이
usage of -bsf:v hevc_mp4toannexb -an
내 mp4 파일 위에 다음과 같은 비디오 인코딩 협력했습니다 따라 다른 대안을 사용해야 할 수 있습니다.
h264_mp4toannexb
이러한 모든 가능한 비트스트림 필터링합니다 usb. https://ffmpeg.org/ffmpeg-bitstream-filters.html
"' ffmpeg $ (f 에 대한 .mp4. i $ f " 못하며창조된 에코 뻨을 ";; 수행되) - filter_complex\ ", $ (i = 0; f 에 대한 .mp4. 에코 실행하십시오 뻨을 " ", [$ i a], [v $ i:] . i = $ ((i + 1)); 수행되\ & &; 에코 ", concat = n = $ i: [v] [a] ", v = 1 = 1) ". - [v] " 매핑해야 "; - [a] " 매핑해야 "; output.mp4 "'
N 이 명령을 조인 b 순서를 작업공간에서 파일에 they& # 39 라는, re (즉, 동일한 순서에 따라 they& # 39, re 제시한 'ls *.mp4 실행할 경우') - 내 경우 각 트랙 번호를 가지고 있기 때문에, 그들은 협력했습니다 멋지구리해요.
여기서 설명하는, concat 프로토콜 https://trac.ffmpeg.org/wiki/Concatenate # 프로토콜
명명된 파이프 구현됩니까 피하기 위해 중간 파일을 사용할 때
매우 빠른 (검토완료: 인스턴트), 주님으로부터그에게 프레임이면 떨어트림 및 효과적입니다.
명명된 파이프 파일과 너희에게베풀어진 동영상은 H264 반드시 삭제하시겠습니까 여부를 확인할 수 있는 ffmpeg - i '와 AAC 못하며창조된 부트해 filename.mp4' (확인할지 h264 와 aac 기재)