i have two videos a1.mp4 and a2.mp4 from the same source for the testing purpose, they are short.
how can i join them in to 1?
i tried 4 ways written in websites somewhere. but all didnt work
1. ffmpeg.exe -i A1.mp4 -i A2.mp4 A12.mp4 -newvideo -newaudio
this is my 1st trial but it didnt work
2. ffmpeg.exe -i A1.mp4 -i A2.mp4 A12.mp4
didnt work
3. ffmpeg -i “concat:a1.mp4|a2.mp4” a12.mp4
didnt work
4. ffmpeg -i a1.mp4 -i a2.mp4 -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]” a12.mp4
didnt work
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 15 of 15
Thread
-
-
Try:
Code:ffmpeg.exe -f concat -i list.txt -c copy a12.mp4
Code:file 'a1.mp4' file 'a2.mp4'
-
jagabo is correct as always, but your example #3 should have worked. Please copy the exact error message if you want help with it.
Note, you show curly quotes (“concat:a1.mp4|a2.mp4”) but you need straight quotes ("concat:a1.mp4|a2.mp4")
Code:ffmpeg.exe -i "concat:a1.mp4|a2.mp4" -c copy a12.mp4
-
ffmpeg.exe -y -f concat -i list.txt -c copy a12.mp4
file 'b1.mp4'
file 'b2.mp4'
working well, but i need this for many file joinings someday, i need the one below
--------------------------------
ffmpeg.exe -y -i "concat:b1.mp4|b2.mp4" -c copy a12.mp4
not working because a12.mp4 was created but it was the same as b1.mp4Last edited by sommers; 6th Jun 2017 at 10:12.
-
Last edited by jagabo; 6th Jun 2017 at 11:11.
-
Another way to build the cat list. Put this in a batch file:
Code:del list.txt FOR %%a IN (%*) DO ( @echo File '%%a' >>list.txt )
-
Here's a full batch file that builds a list of the files dragged onto it, opens Notepad so you can reorder the list, then concatenates the files in the list to an output file of the same name and extension as the first file in the list -- excpet that .cat is added between the name and extension. The pause near the end is to let you see any error messages and review the list.txt file before it's deleted.
Code:del list.txt FOR %%a IN (%*) DO ( @echo file '%%~nxa' >>list.txt ) notepad list.txt "g:\program files\ffmpeg\bin\ffmpeg.exe" -f concat -safe 0 -i list.txt -c copy "%~n1.cat%~x1" pause del list.txt
-
aa=FOR %%a IN (%*) DO ( @echo file '%%~nxa' >>list.txt )
bb=FOR %%a IN (*.*) DO ( @echo file '%%~nxa' >>list.txt )
what is the difference between aa= and bb=, they both seem to make the same results,
in other words, the difference between %* and *.*
>"you can drag/drop files onto that batch file"
this is amazing. i dont know about this until now. i found there is a potential usage here about console commands and mouse interface. i gotta talk to ztree maker about this if there is a way to implement this with their menus. in other words, all my batch scripts are in the ztreemenu which doesnt support a mouse.
can you enlighten me with a few words what console symbol or an idea specially makes "console commands and mouse interface" possible from FOR %%a IN (%*) DO ( @echo file '%%~nxa' >>list.txt ), somehow i think it is %%a's ability to pass the mouse selectecd strings to %%aLast edited by sommers; 6th Jun 2017 at 21:47.
-
(%*) are all the arguments on the command line
(*.*) are all files in the folder
If you highlight a bunch file files in Explorer and drop them onto a batch file (or program), Explorer passes all the file names to the batch file as if you had typed them. Ie, highlighting file1.mp4 and file2.mp4 then dragging them onto DOIT.BAT is the same as typing "DOIT.BAT file1.mp4 file2.mp4" at the command line. -
1. where can i find some help words about %~x1 from the console command like c:\>for /? but not from the web help.
2. i need to add some error controls
IF "%~x1"=="" ECHO "%~x1" & GOTO :EOF
works
IF "%*"=="" ECHO "%*" & GOTO :EOF
doesnt work, how can i make it work?
ffmpeg.exe -i "concat:a1.mp4|a2.mp4" -c copy a12.mp4
i hope they make this work someday soon -
First, you need a decent command line reference: https://ss64.com/nt/. Beware, the are some variations depending on whether you are using XP, Win7, Win10, etc.
Parameter Extensions: https://ss64.com/nt/syntax-args.html
"%~x1" is the extension of the first filename on the command line. "%1" is the first argument on the command line, in this case the first full filename (eg. "C:\folder\filename.ext". "%~dpnx1" is also the full filename. Etc. Be careful, sometimes the filename includes surrounding double quotes, sometimes not. I think the rule with "%1" syntax the name will include quotes if there are spaces in the path/name, otherwise not. With the "%~dpn1" syntax there are no quotes -- you may need to supply them yourself depending on usage.
In the first case you are testing the first argument on the command line. The second case doesn't make sense -- "%*" is a list of arguments, not any particular argument. I don't think it can ever be null because the first argument, "%0", the name of the batch or exe file, is always present. It's not included in FOR loop processing.
I used a FOR loop for building the list because it allows for a variable number of arguments. But you could also do it linearly. Ie, instead of:
Code:del list.txt FOR %%a IN (%*) DO ( @echo file '%%~nxa' >>list.txt )
Code:del list.txt IF EXIST %1 @echo File '%1' >>list.txt IF EXIST %2 @echo File '%2' >>list.txt IF EXIST %3 @echo File '%3' >>list.txt IF EXIST %4 @echo File '%4' >>list.txt IF EXIST %5 @echo File '%5' >>list.txt IF EXIST %6 @echo File '%6' >>list.txt IF EXIST %7 @echo File '%7' >>list.txt IF EXIST %8 @echo File '%8' >>list.txt IF EXIST %9 @echo File '%9' >>list.txt
With either of those methods you could test for the existence of list.txt to determine if there were any filenames on the command line.
By the way, if you know that the files to be appended will always be appended in alphabetical order you could use SORT to make sure the names are in the correct order, rather than spawning Notepad. -
Code:
@Echo Off color 6 del *.tmp set "d=" if not defined d set "d=%cd% del concatList.txt rem xcopy /y v:\automazioneclip\core\processaTuttiFileMxfSenzaSovrascrivereAVI_SD.bat "%d%" rem start call "%d%\processaTuttiFileMxfSenzaSovrascrivereAVI_SD.bat" REM -- Define File Filter, i.e. files with extension .txt Set FindStrArgs=/E /C:".MXF" REM -- Extract Ftp Script to create List of Files Set "FtpCommand=ls" Call:extractFileSection "[Ftp Script 1]" "-">"%temp%\%~n0.ftp" Rem Notepad "%temp%\%~n0.ftp" REM -- Execute Ftp Script, collect File Names Set "FileList=" For /F "Delims=" %%A In ('"Ftp -v -i -s:"%temp%\%~n0.ftp"|Findstr %FindStrArgs%"') Do ( Call Set "FileList=%%FileList%% "%%A"" ) REM -- Extract Ftp Script to download files that don't exist in local folder Set "FtpCommand=mget" For %%A In (%FileList%) Do If Not Exist "%%~A" Call Set "FtpCommand=%%FtpCommand%% "%%~A"" Call:extractFileSection "[Ftp Script 1]" "-">"%temp%\%~n0.ftp" Rem Notepad "%temp%\%~n0.ftp" For %%A In (%FtpCommand%) Do Echo.%%A REM -- Execute Ftp Script, download files ftp -i -s:"%temp%\%~n0.ftp" Del "%temp%\%~n0.ftp" SETLOCAL Disabledelayedexpansion del concatList.txt set mypath= call :treeProcess goto :eof :treeProcess setlocal for %%f in (*.mxf) do echo file '%cd%\%mypath%%%f' >> "concatList.txt" endlocal rem ******************************** HD to mp4HD420 MAIN profile media qualità *********************************** v:\automazioneclip\core\ffmpeg64bitmar2017.exe -threads 12 -y -f concat -safe 0 -i concatList.txt -filter_complex "[0:1] [0:2] amerge" -vf scale=interl=1 -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -g 33 -bf 2 -crf 24 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -aspect 16:9 MP4_HD_420.MP4 rem ******************************************************************************************************************************* pause rem ******************************** HD to mp4HD qualità standard *********************************** v:\automazioneclip\core\ffmpeg64bitmar2017.exe -threads 12 -y -f concat -safe 0 -i concatList.txt -filter_complex "[0:1] [0:2] amerge" -pix_fmt yuv422p -c:v libx264 -profile:v high422 -level:v 3 -g 33 -bf 2 -crf 22 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -aspect 16:9 MP4concatenatoHD.mp4 rem ******************************************************************************************************************************* pause rem ******************************** HD to mp4SD media qualità per fare in fretta crf(SD) a 22 *********************************** v:\automazioneclip\core\ffmpeg64bitmar2017.exe -threads 12 -y -f concat -safe 0 -i concatList.txt -filter_complex "[0:1] [0:2] amerge" -vf yadif=1:tff,scale=w=720:h=576:in_range=tv:out_range=tv,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.8,colormatrix=bt709:bt601,interlace -sws_flags lanczos+accurate_rnd -pix_fmt yuv422p -c:v libx264 -profile:v high422 -level:v 3 -g 33 -bf 2 -crf 22 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -aspect 16:9 MP4concatenatoHDtoSDmediaQualita.mp4 rem ******************************************************************************************************************************* pause rem ******************************** HD to mp4SD SD alta qualità ******************************** v:\automazioneclip\core\ffmpeg64bitmar2017.exe -y -f concat -safe 0 -i concatList.txt -filter_complex "[0:1] [0:2] amerge" -color_range 2 -vf yadif=1:tff,zscale=w=720:h=576:f=spline36:r=full,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.8,colormatrix=bt709:bt601,interlace -color_range 2 -pix_fmt yuv422p -c:v libx264 -profile:v high422 -level:v 3 -g 33 -bf 2 -crf 15 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -aspect 16:9 MP4concatenatoHDtoSD.mp4 rem ************************************************************************** pause rem ******************************** HD to mp4HD qualità standard *********************************** v:\automazioneclip\core\ffmpeg64bitmar2017.exe -threads 12 -y -f concat -safe 0 -i concatList.txt -filter_complex "[0:1] [0:2] amerge" -pix_fmt yuv422p -c:v libx264 -profile:v high422 -level:v 3 -g 33 -bf 2 -crf 22 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -aspect 16:9 MP4concatenatoHD.mp4 rem ******************************************************************************************************************************* pause v:\automazioneclip\core\FFMPEG.exe -threads 12 -y -f concat -i concatList.txt -af "pan=stereo:c0=c0:c1=c1,volume=1.0" -vf crop=720:576:0:32,scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 3 -g 33 -bf 1 -crf 18 -flags +ilme+ildct -top 1 -x264opts tff=1 -c:a libmp3lame -b: 320k -aspect 16:9 MP4concatenatoTGR_BO_420_SD.mp4 pause v:\automazioneclip\core\ffmpeg.exe -y -f concat -i concatList.txt -filter_complex "[0:1] [0:2] amerge" -vcodec copy -c:a pcm_s24le -aspect 16:9 concatHD.mov rem v:\automazioneclip\core\ffmpeg.exe -y -f concat -i concatList.txt -af "pan=stereo:c0=c0:c1=c1,volume=1.0" -vcodec copy -c:a pcm_s24le -aspect 16:9 concatIMX.mov rem ********************** le seguenti 3 linee convertono il file HD concatHD.mov [attenzione a non rinominarlo] in IMX SD ****************************************** rem v:\automazioneclip\core\ffmpeg.exe -y -i concatHD.mov -af "pan=stereo:c0=c0:c1=c1" -c:a pcm_s16le -ar 48000 tmpAudio.wav rem v:\automazioneclip\core\ffmpeg.exe -y -i concatHD.mov -vf yadif=1:tff,scale=720:576,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.8,colormatrix=bt709:bt601,interlace -sws_flags lanczos+accurate_rnd -an -pix_fmt yuv422p -c:v rawvideo -f rawvideo - | v:\automazioneclip\core\ffmbc.exe -y -f rawvideo -pix_fmt yuv422p -s 720x576 -r 25 -i - -i tmpAudio.wav -acodec pcm_s24le -target imx50 -aspect 16:9 concatHDtoIMX_SD.mxf rem ***************************************************************************************************************************************************************** rem *** per TGR Bologna file HD e SD 4:2:0 *** rem v:\automazioneclip\core\ffmpeg.exe -y -f concat -i concatList.txt -filter_complex "[0:1] [0:2] amerge" -c:v libx264 -profile:v main -level:v 4.1 -g 33 -bf 1 -crf 18 -flags +ildct+ilme -top 1 -x264opts tff=1:colorprim=bt709:transfer=bt709:colormatrix=bt709 -filter_complex crop=out_h=1080:y=0,scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv420p -c:a libmp3lame -b:a 320k -ar 48000 -aspect 16:9 MP4concatenatoTGR_BO_420_HD.mp4 rem v:\automazioneclip\core\ffmpeg.exe -y -f concat -i concatList.txt -af "pan=stereo:c0=c0:c1=c1,volume=1.0" -vf crop=720:576:0:32,scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 3 -g 33 -bf 1 -crf 16 -flags +ilme+ildct -top 1 -x264opts tff=1 -c:a libmp3lame -b: 320k -aspect 16:9 MP4concatenatoTGR_BO_420_SD.mp4 if exist tmpAudio.wav del tmpAudio.wav start "" "%programfiles%\Elecard\Elecard Converter Studio\ConverterStudio.exe" del concatList.txt GOTO:EOF :extractFileSection StartMark EndMark FileName -- extract a section of file that is defined by a start and end mark :: -- [IN] StartMark - start mark, use '...:S' mark to allow variable substitution :: -- [IN,OPT] EndMark - optional end mark, default is first empty line :: -- [IN,OPT] FileName - optional source file, default is THIS file :$created 20080219 :$changed 20100205 :$categories ReadFile :$source http://www.dostips.com SETLOCAL Disabledelayedexpansion set "bmk=%~1" set "emk=%~2" set "src=%~3" set "bExtr=" set "bSubs=" if "%src%"=="" set src=%~f0& rem if no source file then assume THIS file for /f "tokens=1,* delims=]" %%A in ('find /n /v "" "%src%"') do ( if /i "%%B"=="%emk%" set "bExtr="&set "bSubs=" if defined bExtr if defined bSubs (call echo.%%B) ELSE (echo.%%B) if /i "%%B"=="%bmk%" set "bExtr=Y" if /i "%%B"=="%bmk%:S" set "bExtr=Y"&set "bSubs=Y" ) [Ftp Script 1]:S !Title Connecting... open 192.168.0.18 admin pdw-f800 !Title Preparing... cd clip lcd %cd% binary hash !Title Processing... %FtpCommand% %FtpCommand% !Title Disconnecting... disconnect bye
-
sorry I'm a CAT (not a ConCat) this is my custom batch, I cannot program and code but I use it.
If you want use a part of it: it auto-connect as ftp site the camera and "download" all .mxf files, create a concat.txt list and do some encode -
You can join all the files in MKVMerge / MKVToolnix. The output will be mkv.
But you can just use this:Code:ffmpeg -i "a12.mkv" -c copy "a12.mp4"
If they are named sequentially, MKVMerge will ask to import and join them all in order.
Similar Threads
-
Homemade mp4 files quality vs. ripped movies in mp4 format
By MrMX in forum Newbie / General discussionsReplies: 11Last Post: 26th Nov 2015, 22:12 -
Join two mp4 videos with Avidemux (and similar tools)
By benzio in forum Video ConversionReplies: 9Last Post: 29th Oct 2015, 10:23 -
Append / Join MP4 Videos
By darkw1zard in forum Video ConversionReplies: 7Last Post: 21st Feb 2014, 23:02 -
Plain English Guide to MP4Box and Repacking MKV-MP4, MP4-MP4 (M4V).
By raregrit in forum Video ConversionReplies: 3Last Post: 8th Jul 2013, 12:52 -
Cannot seem to convert MKV to MP4 or AVI to MP4 without audio sync issues
By Matth3w in forum Video ConversionReplies: 0Last Post: 16th Sep 2012, 13:36