VideoHelp Forum
+ Reply to Thread
Results 1 to 30 of 30
Thread
  1. Hi cats,

    for kindness, I have this problem: I have to assign as video source for ffmpeg a .avs, and for audio source the original .mxf file that are use also by avisynth to extract the video part

    I have a folder called v:\micio in wich there is a file mxf called gatto.mxf

    so the audiovideo source .mxf is v:\micio\gatto.mxf (it's a xdcamhd422 file with audio similar to https://www.dropbox.com/s/7nx4i1dcql02wmv/HD169.MXF)


    I try to batch automate a procedure that do a ffmpeg resize from HD to SD and FFmpeg use as source a .avs file created by the batch in the same dir of the input file (that are drag and dropped into the batch icon on the desktop, OR that are manually input typing v:\micio\gatto.mxf when request launching the batch) so the automatically .avs file created by the batch is placed in v:\micio\gatto.avs

    So ffmpeg have to assume as video source v:\micio\gatto.avs

    In the batch the .avs file is %2
    that are gatto.avs


    meanwhile the original .mxf file processed is: %CD%\%~n1.mxf
    that are v:\micio\gatto.mxf

    Now I have do the batch so the (red, and wrong) commandline of ffmpeg become:


    Code:
    v:\automazioneclip\core\ffmpeg.exe -y -i v:\micio\gatto.avs -i v:\micio\gatto.mxf -map_channel 0.1.0 -map_channel 0.2.0 -c:v libx264 -profile:v high422 -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 scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv422p -aspect 16:9 -r 25 -c:a libvo_aacenc -b 256k v:\micio\gattodaHdaSDMP4.mp4



    from the batch:
    Code:
    v:\automazioneclip\core\ffmpeg.exe -y -i "%2" -i "%CD%\%~n1.mxf" -map_channel 0.1.0 -map_channel 0.2.0 -c:v libx264 -profile:v high422 -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 scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv422p -aspect 16:9 -r 25 -c:a libvo_aacenc -b 256k %WorkFolder%\%~n1daHdaSDMP4.mp4


    I think the error is the -i v:\micio\gatto.mxf line, to assign the audio source, but to indicate at ffmpeg that it have to get audio from v:\micio\gatto.mxf what I have to do?

    The original batch is this:







    Code:
    @rem unless otherwise specified for debugging reasons turn echo off
    @if "%EMode%"=="" Set EMode=ON
    @ECHO %EMode%
    @ECHO off
    
    SetLocal DisableDelayedExpansion
    
    Set "EXTMXF=*.mxf"
    Set "DoPop=0"
    Set "ARGLVL=0"
    Set "FileName-DQ="
    Set VDM_LOC="v:\automazioneclip\VirtualDubMOD\virtualdubmod.exe"
    
    set "DestFolder=."
    Set "WorkFolder=%DestFolder%"
    
    if not exist %DestFolder% mkdir %DestFolder%
    
    rem process the arguments one by one
    :ARGSMXF
    	
    	rem if there are no further arguments then exit the batch.
    	if [%1]==[] (
    		if "%ARGLVL%"=="0" (
    			CALL :GetTargetNameMXF		
    			EndLocal
    			pause
    		)
    		goto :eof
    	)
    
    	rem wildcard processing
    	Set "FileName=%~1"
    	if "%FileName%"=="" (
    		SHIFT
    		goto :ARGSMXF
    	)
    
    	rem if the argument doesn't exist in the file system in any form skip it.
    	if NOT EXIST %1 (
    		SHIFT
    		goto :ARGSMXF
    	)
    
    	if NOT [%1]==[] if NOT "%FileName:^*=%%FileName:^?=%"=="%FileName%%FileName%" (
    		for %%w in (%1) DO (
    			Set /a ARGLVL+=1
    			CALL :ARGSMXF "%%~fw"
    			Set /a ARGLVL-=1
    		)
    		SHIFT
    		goto :ARGSMXF
    	)
    	Set "FileName="
    		
    	rem Set search/recursion variables
    	Set "Pattern=%EXTMXF%"
    	Set "STARTLVL=0"
    	Set "FOUNDLVL=1024"
    	
    	rem if the argument is the current directory then process everything in it.
    	if "%~f1"=="%CD%" (
    		rem echo Processing Directory "%CD%"
    		CALL :STARTMXF %1
    		SHIFT
    		goto :ARGSMXF
    	)
    	rem Test if the argument is a directory, if it is move to it then process everything in it, if not then move to the file's parent directory and process the file.  Then return to starting directory.
    	Type NUL
    	pushd "%~f1" 2> nul
    	if NOT "%errorlevel%"=="0" (
    		if NOT "%CD%\"=="%~dp1" (
    			pushd "%~dp1"
    			Set "DoPop=1"
    		)
    		Set Pattern="%~nx1"
    	) else (
    		rem echo Processing Directory "%~f1"
    		Set "DoPop=1"
    	)
    	CALL :STARTMXF %1
    	if "%DoPop%"=="1" (
    		popd
    		Set "DoPop=0"
    	)
    	SHIFT
    
    goto :ARGSMXF
    
    :STARTMXF <CURRENT_ARG>
    
    	rem Count is superseded by FOUNDLVL but may still be useful for renaming purposes
    	Set "Count=0"
    	rem Process all files in the current directory fitting the arguments search pattern.
    	for /f "delims=" %%y in ('dir %Pattern% /b /od /a-d') do (
    		if /I NOT "%%~y"=="File Not Found" CALL :Process_MXF "%%~fy"
    	)
    	rem if it didn't find anything search all directories instead
    goto :eof
    	if "%Count%"=="0" if %STARTLVL% LSS %FOUNDLVL% (
    		for /d %%b in (*) do (
    			pushd "%%~fb"
    			rem echo Processing Directory "%%~fb"
    			Set /a STARTLVL+=1
    			CALL :STARTMXF "%%~fb"
    			Set /a STARTLVL-=1
    			popd
    		)
    	)
    
    goto :eof
    
    :Process_MXF <AVI_FILENAME>
    
    	Set /a Count+=1
    	Set "FOUNDLVL=%STARTLVL%"
    
    	echo Processing "%CD%\%~nx1"
    	if /I NOT "%~x1"==".mxf" (
    		echo "%~nx1"
    		echo  is not a .mxf file
    		rem pause
    		rem goto :eof
    	)
    	
    	)
    
    	
    	SetLocal DisableDelayedExpansion
            if exist "%~dpn1.wav" (
            set "Audio=%~dpn1.wav"
            ) else (
            set "Audio=v:\automazioneclip\system\empty.wav")
            rem Find TimeCode Info
         	Set AUCount=0;
    	for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdubmod\FFProbe -hide_banner -loglevel fatal -pretty -show_streams -show_entries stream^=codec_type^,width^,height^,sample_aspect_ratio:stream_disposition^=:format_tags^=timecode^,company_name^,product_name^,product_version "%~1" 2^>^&1') DO (
    		 if "%%~g"=="TAG:company_name" set "T_Company_Name=%%~h"
    		 if "%%~g"=="TAG:product_name" set "T_Product_Name=%%~h"
    		 if "%%~g"=="TAG:product_version" set "T_Product_Version=%%~h"
    		 if "%%~g"=="TAG:timecode" set "TIMECODE=%%~h"
    		 if "%%~g"=="width" set "V_Width=%%~h"
    		 if "%%~g"=="height" set "V_Height=%%~h"
    		 if "%%~g"=="sample_aspect_ratio" set "V_PAR=%%~h"
    		 if "%%~g"=="codec_type" if "%%~h"=="audio" set /a AUCount+=1
    	)
    	if "%V_Width%"=="" (
    		echo  ERROR: Video Width NOT FOUND!
    		pause
    		goto :eof
    	)
    	if "%V_Height%"=="" (
    		echo  ERROR: Video Height NOT FOUND!
    		pause
    		goto :eof
    	)
    	if "%V_PAR%"=="" (
    		echo  ERROR: Video PAR NOT FOUND!
    		pause
    		goto :eof
    	)
    	rem Set "V_Q=UD"
    	rem if %V_Width% LEQ 1920 if %V_Height% LEQ 1120 \\
    	Set "V_Q=HD"
    	rem if %V_Width% LEQ 1280 if %V_Height% LEQ 752 Set "V_Q=MD"
    	if %V_Width% LEQ 1024 if %V_Height% LEQ 608 Set "V_Q=SD"
    	echo  Using MXF %V_Q% Mode
    	echo  PAR = %V_PAR%
    	if "%TimeCode%"=="" echo Warning! no TimeCode Found!
    	if NOT "%TimeCode%"=="" echo Timecode= %TIMECODE%
    
    if "%V_Q%"=="HD" (CALL :MakeMXFHD2SD "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    if "%V_Q%"=="SD" (CALL :MakeMXFSD2HD "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    
    rem CALL :MAKEVCF "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1"
    
    	echo  FATTO
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    
    
    :MakeMXFHD2SD <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <MXF_FILENAME>
    
            echo *** da File MXF HD a MP4 SD ***
    
         echo  *** da File MXF SD-iMX a MP4 HD e !MXF HD! ***
    
         echo FFVideoSource^(%4^)>%2
         echo ColorMatrix^(mode="Rec.709->Rec.601"^)>>%2
         echo IResize(720,576^)>>%2
         echo function IResize^(clip Clip, int NewWidth, int NewHeight^) {>>%2
         echo Clip>>%2
         echo SeparateFields^(^)>>%2
         echo Shift=^(GetParity() ? -0.25 : 0.25) * ^(Height()/Float(NewHeight/2)^-1.0^)>>%2
         echo E  = SelectEven^(^).Spline36resize^(NewWidth, NewHeight/2, 0,    Shift^)>>%2
         echo O  = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0,   -Shift^)>>%2
         echo Ec = SelectEven^( ^).Spline36resize^(NewWidth, NewHeight/2, 0,  2*Shift^)>>%2
         echo Oc = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -2*shift^)>>%2
         echo Interleave^(E, O^)>>%2
         echo IsYV12^(^) ? MergeChroma^(Interleave(Ec, Oc)^) : Last >>%2
         echo Weave^(^)>>%2
         echo } >>%2
         echo AssumeTFF^(^)>>%2
         echo SeparateFields^(^)>>%2
         echo Ev=SelectEven^(^).sharpen(0.20^)>>%2
         echo Od=SelectOdd^(^).sharpen^(0.20^)>>%2
         echo Interleave^(Ev,Od^)>>%2
         echo Weave^(^)>>%2
         echo AssumeFPS^(25^)>>%2
    
         echo processing source file %CD%\%~n1.mxf
    
         v:\automazioneclip\core\ffmpeg.exe -y -i "%2" -i "%CD%\%~n1.mxf" -map_channel 0.1.0 -map_channel 0.2.0 -c:v libx264 -profile:v high422 -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 scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv422p -aspect 16:9 -r 25 -c:a libvo_aacenc -b 256k %WorkFolder%\%~n1daHdaSDMP4.mp4 
            
    
    goto :eof
    
    :MakeMXFSD2HD <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <MXF_FILENAME>
    
         
    
         rem v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.mxf" -map_channel 0.1.0 -map_channel 0.2.0 -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 libvo_aacenc -b 256k -aspect 16:9 %WorkFolder%\%~n1EncodingDaMXForiginalePerTgRbologna420.mp4
         rem v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.mxf" -map_channel 0.1.0 -map_channel 0.2.0 -c:v libx264 -profile:v high422 -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 yuv422p -c:a libvo_aacenc -b 256k -aspect 16:9 %WorkFolder%\%~n1EncodingDaFileMXForiginale.mp4         
             
    
    goto :eof
    
    
    :GetTargetNameMXF
    
    	Set "FileName="
    	Set /p FileName=InputFileName.mxf o InputFolder - INVIO per convertire tutto (EXIT esce):
    	
    	rem Add or remove double-quotes if necessary
    
    	if NOT DEFINED FileName (
    		Set "FileName-DQ="
    		goto :DQSkipMXF
    	)
    	
    	Set "FileName-DQ=%FileName:"=%"
    	if NOT DEFINED FileName-DQ (
    		Set "FileName="
    		Set "FileName-DQ="
    		goto :DQSkipMXF
    	)
    	
    	if EXIST "%FileName-DQ%" (
    		if "%FileName-DQ%"=="%FileName-DQ: =%" (
    			Set "FileName=%FileName-DQ%"
    		) else (
    			Set FileName="%FileName-DQ%"
    		)
    	)
    
    :DQSkipMXF
    
    	if /I "%FileName-DQ%"=="" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="CD" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="EXIT" goto :eof
    	if /I "%FileName-DQ%"=="NOEXIT" goto :GetTargetNameMXF
    	if DEFINED FileName (
    		Set /a ARGLVL+=1
    		CALL :ARGSMXF %FileName%
    		Set /a ARGLVL-=1
    	)
    	
    goto :GetTargetNameMXF








    thanks
    Quote Quote  
  2. this the ffmpeg error:

    processing source file V:\micio\gatto.mxf
    ffmpeg version N-64405-g7d179b1 Copyright (c) 2000-2014 the FFmpeg developers
    built on Jul 3 2014 22:02:04 with gcc 4.8.3 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
    e --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
    libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libope
    njpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsox
    r --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-decklink --enable-zlib
    libavutil 52. 90.101 / 52. 90.101
    libavcodec 55. 68.100 / 55. 68.100
    libavformat 55. 45.100 / 55. 45.100
    libavdevice 55. 13.101 / 55. 13.101
    libavfilter 4. 10.100 / 4. 10.100
    libswscale 2. 6.100 / 2. 6.100
    libswresample 0. 19.100 / 0. 19.100
    libpostproc 52. 3.100 / 52. 3.100
    Input #0, avisynth, from '.\gatto.avs':
    Duration: 00:00:11.16, start: 0.000000, bitrate: 0 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 720x576, 25 fps,
    25 tbr, 25 tbn, 25 tbc
    Guessed Channel Layout for Input Stream #1.1 : mono
    Guessed Channel Layout for Input Stream #1.2 : mono
    Guessed Channel Layout for Input Stream #1.3 : mono
    Guessed Channel Layout for Input Stream #1.4 : mono
    Guessed Channel Layout for Input Stream #1.5 : mono
    Guessed Channel Layout for Input Stream #1.6 : mono
    Guessed Channel Layout for Input Stream #1.7 : mono
    Guessed Channel Layout for Input Stream #1.8 : mono
    Input #1, mxf, from 'V:\micio\gatto.mxf':
    Metadata:
    uid : 24271e00-2968-05c1-0270-08004602023b
    generation_uid : 24271e00-2968-05c2-0270-08004602023b
    company_name : SONY
    product_name : Opt
    product_version : 1.22
    product_uid : 060e2b34-0401-0103-0e06-012002010300
    modification_date: 2014-06-21 21:57:11
    timecode : 01:28:04:05
    Duration: 00:00:11.16, start: 0.000000, bitrate: 60493 kb/s
    Stream #1:0: Video: mpeg2video (4:2:2), yuv422p(tv, bt709), 1920x1080 [SAR 1
    :1 DAR 16:9], max. 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #1:1: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #1:2: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #1:3: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #1:4: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #1:5: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #1:6: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #1:7: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    Stream #1:8: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
    mapchan: invalid input file stream index #0.1
    Quote Quote  
  3. since audio from input file1 (the mxf) , not input file0 (the avs), use

    Code:
    -map_channel 1.1.0 -map_channel 1.2.0

    syntax for -map_channel is file.stream.channel

    0.1.0 doesn't exist, because avs has no audio stream #1; Only 0.0 exists (video)
    Quote Quote  
  4. Code:
    v:\automazioneclip\core\ffmpeg.exe -y -i "%2" -i "%CD%\%~n1.mxf" -map_channel 1.1.0 -map_channel 1.2.0 -c:v libx264 -profile:v high422 -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 scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv422p -aspect 16:9 -r 25 -c:a libvo_aacenc -b 256k %WorkFolder%\%~n1daHdaSDMP4.mp4
    thanks poison, only 1 old problem: the output mp4 have only 1 track mono that correspond the first audio cannhel in the original .mxf
    how I can modify the commandline so the output mp4 have 2 separate classic audio channel L+R stereo, in wich audio CH1 is the same of audio CH1 of the camera and audio CH2 the same of CH2 of the camera? thanks
    Quote Quote  
  5. use filter_complex and amerge

    Remember this thread?
    https://forum.videohelp.com/threads/364166-audio-impossible?p=2318006

    Instead of [0:1] [0:2]

    You would use [1:1] [1:2] , because input file for the audio is #1 (the mxf) not #0 (the avs)
    Quote Quote  
  6. Code:
    ffmpeg.exe -y -i v:\micio\gatto.avs -i v:\micio\gatto.mxf -filter_complex "[1:1] [1:2] amerge,volume=2" -c:v libx264 -profile:v high422 -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 scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv422p -aspect 16:9 -r 25 -c:a libvo_aacenc -b 256k out.mp4
    I have try this but the out.mp4 have alwais the one and the first audio ch1 of the camera, I would like have 2 audio channels but I'm not able to modify the commanline
    Last edited by marcorocchini; 15th Jul 2014 at 18:28.
    Quote Quote  
  7. out.mp4 have alwais the one and the first audio ch1 of the camera, I would like have 2 audio channels
    Possibly your audio streams are misnumbered compared to ffmpeg's stream numbering (maybe you selected wrong , silent stream) . CH1 might not correspond to 1.1, CH2 might not correspond to 1.2 etc...

    Open out.mp4 in audacity and look if there are 2 channels (one might be "silent"), 1 track . Mono would have 1 channel and 1 track
    Last edited by poisondeathray; 15th Jul 2014 at 18:39.
    Quote Quote  
  8. Oh no sory, vlc confused me because I seen only "track1". Now it work well, thanks poison!

    Can I answer this; and if I encode in .avi file (mpeg in avi) would be a better idea or not? thank uu
    Quote Quote  
  9. Are you sure?




    I have one of your test files "ORIGINAL.mxf". If I open up in audacity, 1st audio track is silent. The audible audio starts at track 2
    0:0 is video
    0:1 is 1st audio
    0:2 is 2nd audio
    etc...

    If I do this
    Code:
    ffmpeg -i original.mxf -c:v copy -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le output1.mkv

    Only R audio, L is silent





    But If I do this

    Code:
    ffmpeg -i original.mxf -c:v copy -filter_complex "[0:2] [0:3] amerge" -c:a pcm_s16le output2.mkv
    It's "normal" stereo L+R (not real "stereo", but Ch2 is left and Ch3 is right, both audible)


    So you see, the audio numbering might not be what you think


    and if I encode in .avi file (mpeg in avi) would be a better idea or not?
    MPEG2 in AVI is not good idea (not very compatible)
    Quote Quote  
  10. I have try with -filter_complex "[1:1] [1:2]

    and seems to me is all ok in out.mp4, have changel file using a .mxf that have in ch1 a microphone speek and in ch2 audiocamera, and the mp4 have correctly 1 track stereo l+r with microphone and audiocamera separate, so I think is ok

    If you like I upoload on the dropbox the .mxf file
    Quote Quote  
  11. No it's ok, as long as you're convinced the channels are mapped correctly
    Quote Quote  
  12. Seems to me is ok: ch1 camera = ch1 mp4 and ch2 camera = ch2 mp4 but I will check better

    Poison a kindness:

    https://www.dropbox.com/s/u1gx85anso3acce/IMXSDAUDIO.MXF

    now consider this IMX mxf (sd) that have

    audio ch1 = britney from a microphjone sennh.mkh-816 (audio is better, more present)
    audio ch2 = britney from audio camera (bad audio)
    audio ch3 and ch4 muted (no analog source introduced, but presents)

    And the commandline that convert it from .mxf to .mp4
    Code:
    ffmpeg.exe -y -i IMXSDAUDIO.MXF ??-filter_complex "[0:1:0] [0:1:2] amerge"?? -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 libvo_aacenc -b:a 256k -aspect 16:9 out.mp4
    I cannot find the way to have correct audio on the final out.mp4: it have to be 1 track stereo L+R where is the ch1 and ch2 of the camera, not others

    Many thanks
    Last edited by marcorocchini; 16th Jul 2014 at 06:15.
    Quote Quote  
  13. I think it should be [0:1] [0:2]

    because input file is MXF:

    0:0 is video
    0:1 is 1st audio
    0:2 is 2nd audio
    etc...
    Quote Quote  
  14. also for me, but strangely it does't work. Consider the .mxf, for this time, is IMX SD, not HD


    C:\>v:\automazioneclip\core\ffmpeg.exe -y -i v:\mxfaudio\imxSDaudio.mxf -filter_
    complex "[0:1] [0:2] amerge" -vf crop=720:576:0:32,scale=interl=1:in_range=tvu
    t_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 libvo_aacenc -b:a 256k -a
    spect 16:9 v:\out.mp4
    ffmpeg version N-64405-g7d179b1 Copyright (c) 2000-2014 the FFmpeg developers
    built on Jul 3 2014 22:02:04 with gcc 4.8.3 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
    e --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
    libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libope
    njpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsox
    r --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-decklink --enable-zlib
    libavutil 52. 90.101 / 52. 90.101
    libavcodec 55. 68.100 / 55. 68.100
    libavformat 55. 45.100 / 55. 45.100
    libavdevice 55. 13.101 / 55. 13.101
    libavfilter 4. 10.100 / 4. 10.100
    libswscale 2. 6.100 / 2. 6.100
    libswresample 0. 19.100 / 0. 19.100
    libpostproc 52. 3.100 / 52. 3.100
    Guessed Channel Layout for Input Stream #0.1 : 4.0
    Input #0, mxf, from 'v:\mxfaudio\imxSDaudio.mxf':
    Metadata:
    uid : 7acc0e00-5468-05c1-0270-08004602023b
    generation_uid : 7acc0e00-5468-05c2-0270-08004602023b
    company_name : SONY
    product_name : Opt
    product_version : 1.41
    product_uid : 060e2b34-0401-0103-0e06-012002010300
    modification_date: 2014-07-16 10:46:05
    timecode : 00:02:44:04
    Duration: 00:00:27.40, start: 0.000000, bitrate: 62569 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv), 720x608 [SAR 608:405 DA
    R 16:9], max. 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 4 channels, s32, 4608 kb/s
    Stream specifier ':2' in filtergraph description [0:1] [0:2] amerge matches no s
    treams
    .


    C:\>

    Quote Quote  
  15. using 'code'- or 'quote'-tags makes stuff better readable
    looking at: https://trac.ffmpeg.org/wiki/AudioChannelManipulation
    Code:
    -af "pan=stereo:c0=c0:c1=c1"
    might work (never tested)
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  16. Originally Posted by Selur View Post
    using 'code'- or 'quote'-tags makes stuff better readable
    looking at: https://trac.ffmpeg.org/wiki/AudioChannelManipulation
    Code:
    -af "pan=stereo:c0=c0:c1=c1"
    might work (never tested)
    oh my Name:  CCAT9.JPG
Views: 778
Size:  13.7 KB

    it works!

    sorry sometimes my paw don't press well the key on keyboard ^^ thaks
    Last edited by marcorocchini; 16th Jul 2014 at 09:00.
    Quote Quote  
  17. For kindness: I should have another question

    Return to the HD-->SD conversion:

    for example with this as source

    https://www.dropbox.com/s/7nx4i1dcql02wmv/HD169.MXF

    I try to encode it in SD-MP4 but in avi container, with the commandline tha assume as video source the .avs (all is well working when output container is .mp4)

    Code:
    ffmpeg.exe -y -i "%2" -i "%CD%\%~n1.mxf" -filter_complex "[1:1] [1:2] amerge,volume=2" -c:v libx264 -profile:v high422 -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 scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv422p -aspect 16:9 -r 25 -c:a libvo_aacenc -b:a 256k workFolder%\%~n1daHDaSDMP4.avi
    encoding is semi "ok" but ffmpeg report this "bitstream error startcode missing"

    If I try open the .avi in virtualdub is returns the audio error

    Click image for larger version

Name:	VBR.JPG
Views:	276
Size:	110.9 KB
ID:	26441

    and when I open the .avi but firt frame is black (decoder is VFW "vidc.h264=x264vfw.dll, confirmed also in virtualdub File Information)

    and for second: to correctly open a mpeg in avi file in virtualdub, what can I use?

    I have installed the FFMPEGInputDriver 0.8.1.4 plugin but it seems act for .mp4 and not for .avi file although it's a mpeg in avi, can I configure it to open also mpeg in avi files?
    Last edited by marcorocchini; 16th Jul 2014 at 10:16.
    Quote Quote  
  18. stuffing H.264&aac inside an .avi container is a bad idea, since afaik there is no splitter which can really handle aac inside an .avi container properly (=seeking&normal playback does work).
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  19. Originally Posted by Selur View Post
    stuffing H.264&aac inside an .avi container is a bad idea, since afaik there is no splitter which can really handle aac inside an .avi container properly (=seeking&normal playback does work).
    mm I understand, what is the best alternative? I'm tryed with mp3 lame and seems the ffmpeg don't return the "bitstream error startcode missing"

    Click image for larger version

Name:	LAME2.JPG
Views:	269
Size:	78.8 KB
ID:	26447

    but when I open the out.avi in virtualdub I get the same error:

    Click image for larger version

Name:	VBRERR.JPG
Views:	315
Size:	10.5 KB
ID:	26448

    Is there a way to resolve?
    Mediainfo says the audio part is CBR, but for VirtualDub is VBR: who have reason?
    Last edited by marcorocchini; 16th Jul 2014 at 13:11.
    Quote Quote  
  20. And also: is there a plugin for virtualdub that can allow to open correctly and internally to virtualdub, mpeg-in-avi files? Possibly I would like avoiding recursion to VFW codecs, or DirecShow codecs.

    I have installed in virtualdub the FFinputDriver 0.8.1.4 but it don't open mpeg-in-avi files, so virtualdub use X264VFW codec ---> = first frame black = irresolvible problem of first frame black
    Quote Quote  
  21. Originally Posted by Selur View Post
    using 'code'- or 'quote'-tags makes stuff better readable
    looking at: https://trac.ffmpeg.org/wiki/AudioChannelManipulation
    Code:
    -af "pan=stereo:c0=c0:c1=c1"
    might work (never tested)

    Selur a kindness:

    1) and to regulate volume how I can do?

    2) and, to use ch3 and ch4 in place of ch1/2?

    3 please my cats have an answer: can I apply your idea to a HD-mxf file? as the https://www.dropbox.com/s/7nx4i1dcql02wmv/HD169.MXF (but if you want I can upload on my dropbox anhother with audio in ch1 and ch2 because HD169.mxf don't have audio on ch1, and a minimal on ch2) hoewver I would like extract audio ch1 and ch2 of the camera and "transpose" in the final mp4. Your solution match IMX (sd) mxf file, how can I do it for HD files?

    Because I can use this option: -filter_complex "[1:1] [1:2] amerge,volume=2"
    but with this command volume is too high and I cannot set it to 1,5 or 1,7

    Thanks
    Last edited by marcorocchini; 16th Jul 2014 at 14:23.
    Quote Quote  

  22. Mediainfo says the audio part is CBR, but for VirtualDub is VBR: who have reason?
    Not sure, maybe ffmpeg's lamemp3 implementation has a CBR switch, I didn't see one

    Or use AC3, it's CBR only


    Originally Posted by marcorocchini View Post
    And also: is there a plugin for virtualdub that can allow to open correctly and internally to virtualdub, mpeg-in-avi files? Possibly I would like avoiding recursion to VFW codecs, or DirecShow codecs.

    I have installed in virtualdub the FFinputDriver 0.8.1.4 but it don't open mpeg-in-avi files, so virtualdub use X264VFW codec ---> = first frame black = irresolvible problem of first frame black

    Did you select FFMpeg files from the dropdown menu in the open dialog box ?

    Don't use AVC in AVI , or AAC in AVI both causes many problems in many programs . Especially when using b-frames. Use a different container like MP4


    1) and to regulate volume how I can do?

    Because I can use this option: -filter_complex "[1:1] [1:2] amerge,volume=2"
    but with this command volume is too high and I cannot set it to 1,5 or 1,7

    -vf volume uses decimals , not commas - so 1.5 , not 1,5

    https://www.ffmpeg.org/ffmpeg-filters.html#volume


    2) and, to use ch3 and ch4 in place of ch1/2?
    Not sure try

    -af "pan=stereo:c0=c2:c1=c3"
    Quote Quote  
  23. Originally Posted by poisondeathray View Post

    -vf volume uses decimals , not commas - so 1.5 , not 1,5
    Name:  CCAT13.JPG
Views: 631
Size:  20.6 KB

    Originally Posted by poisondeathray View Post

    Did you select FFMpeg files from the dropdown menu in the open dialog box ?
    Name:  CCAT12.JPG
Views: 578
Size:  3.3 KB grrr
    Quote Quote  
  24. and for the IMX case, as I have use -af "pan=stereo:c0=c0:c1=c1" how I have to change the string to regulate audio volume?


    maybe:
    Code:
    -af "pan=stereo:c0=c0:c1=c1:volume=6db"
    ?
    Quote Quote  
  25. Originally Posted by marcorocchini View Post
    and for the IMX case, as I have use -af "pan=stereo:c0=c0:c1=c1" how I have to change the string to regulate audio volume?


    maybe:
    Code:
    -af "pan=stereo:c0=c0:c1=c1:volume=6db"
    ?


    did you try

    -af "pan=stereo:c0=c0:c1=c1,volume=2"

    or

    -filter_complex "pan=stereo:c0=c0:c1=c1,volume=2"


    In ffmpeg, commas separate different filters, colons separate settings within the same filter
    Quote Quote  
  26. I have do many catproofs:

    seems to me that they are identical, and both are functional

    the important things is this: by default seems to me I have to set the volume=2 to have the same levels of the original mxf

    supposing this is the commanline:

    Code:
    ffmpeg.exe -y -i barsSD.mxf -af "pan=stereo:c0=c0:c1=c1,volume=2" -vf crop=720:576:0:32,scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv422p -c:v libx264 -profile:v high422 -level:v 3 -g 33 -bf 1 -crf 18 -flags +ilme+ildct -top 1 -x264opts tff=1 -c:a libvo_aacenc -b: 256k -aspect 16:9 out.mp4
    where barsSD.mxf is the original recording of the bars and EBUL audio levels, and is this

    https://www.dropbox.com/s/41k459jnbzjujt7/barsSD.MXF

    I have tested the audio levels on edius, and it was a very very very difficult test because my cats get nervous when I open
    erdiuscatagainst nle^^
    Click image for larger version

Name:	EDLEV.JPG
Views:	227
Size:	88.6 KB
ID:	26470
    Last edited by marcorocchini; 17th Jul 2014 at 16:29.
    Quote Quote  
  27. the important things is this: by default seems to me I have to set the volume=2 to have the same levels of the original mxf
    Are you saying you must increase the audio for AAC in order to have same levels of MXF ?
    Last edited by poisondeathray; 17th Jul 2014 at 16:43.
    Quote Quote  
  28. Originally Posted by poisondeathray View Post
    the important things is this: by default seems to me I have to set the volume=2 to have the same levels of the original mxf
    Are you saying you must increase the audio for AAC in order to have same levels of MXF ?
    yes bu maybe I'm in error: I'm not considered the multiple audio in edius (I am proud to not know how to use edius) mmm no no no maybe I think audio levels is "straigh" with vol=1 but I'm do others proof
    Quote Quote  
  29. Yes, cat is probably in unfamilar environment and lost

    It's close at default (no volume adjustment), but libvo_aacenc AAC encoder is not that good, and cuts of certain frequencies, so there is going to be some differences. But important point is "mean volume" is the same, and "max volume" is almost the same and isn't dangerously clipping .

    You can check levels with ffmpeg, first encode the audio
    Code:
    ffmpeg -i barsSD.MXF -af "pan=stereo:c0=c0:c1=c1" -c:a pcm_s16le v0.wav
    
    ffmpeg -i barsSD.MXF -af "pan=stereo:c0=c0:c1=c1" -c:a libvo_aacenc -b: 256k a0.aac
    ffmpeg -i barsSD.MXF -af "pan=stereo:c0=c0:c1=c1,volume=2" -c:a libvo_aacenc -b: 256k a2.aac
    Use -af volumedetect to see stats

    Code:
    ffmpeg -i v0.wav -vn -af "volumedetect" -f null NUL 2>v0.txt
    ffmpeg -i a0.aac -vn -af "volumedetect" -f null NUL 2>a0.txt
    ffmpeg -i a2.aac -vn -af "volumedetect" -f null NUL 2>a2.txt

    v0
    [Parsed_volumedetect_0 @ 02d27c40] n_samples: 856320
    [Parsed_volumedetect_0 @ 02d27c40] mean_volume: -12.0 dB
    [Parsed_volumedetect_0 @ 02d27c40] max_volume: -9.0 dB
    [Parsed_volumedetect_0 @ 02d27c40] histogram_9db: 249760

    a0
    [Parsed_volumedetect_0 @ 02d2ad00] n_samples: 860160
    [Parsed_volumedetect_0 @ 02d2ad00] mean_volume: -12.0 dB
    [Parsed_volumedetect_0 @ 02d2ad00] max_volume: -8.8 dB
    [Parsed_volumedetect_0 @ 02d2ad00] histogram_8db: 10946

    a2
    [Parsed_volumedetect_0 @ 02d2ad00] n_samples: 860160
    [Parsed_volumedetect_0 @ 02d2ad00] mean_volume: -6.0 dB
    [Parsed_volumedetect_0 @ 02d2ad00] max_volume: -2.8 dB
    [Parsed_volumedetect_0 @ 02d2ad00] histogram_2db: 30350
    Quote Quote  
  30. Click image for larger version

Name:	CCAT.JPG
Views:	375
Size:	16.7 KB
ID:	26473

    Code:
     -c:a ac3 
    may help?
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!