【求助】帮忙看一下这个ffmpeg的命令行哪里出了问题
dwing吧
全部回复
仅看楼主
level 8
凝芳文 楼主
首先,我要说明一下我写这个bat的用途。因为我使用vegas编辑素材的时候,经常遇到很多AVC素材不能直接导入。本身视频流是能兼容的,问题总是出在音频流上(很多AVC视频都是AC-3音频的这个vegas不能支持)。于是,我希望写一个bat,利用roozhou大的ffmpeg以及neroAacEnc连续执行将音频重编码成AAC并替换掉原来的AC-3音频,再封装成MP4。
上次请教别人,目前的bat是写成这样的,能顺利编码出aac音频,可是并没有把AC-3音频替换掉,封装出来的MP4依旧是AC-3的。请教大家这个问题出在哪里呢?需要怎么改?
@ECHO OFF & CD /D "%~dp0"
dshow2wav "%~1" | neroaacenc -q 0.25 -ignorelength -he -if - -of "%~dpn1_a.aac"
ffmpeg -i "%~1" -vcodec copy -i "%~dpn1_a.aac" -acodec copy -y "%~dpn1_enc.mp4"
pause
del "%~dpn1_a.aac"
2012年01月17日 16点01分 1
level 1
只想到了下面这一种,其他的方法和导致问题的原因就想不出来了……
@ECHO OFF & CD /D "%~dp0"
dshow2wav "%~1" | neroaacenc -q 0.40 -ignorelength -if - -of "%~dpn1_a.m4a"
ffmpeg -i "%~1" -vcodec copy -an -y "%~dpn1_te.mp4"
ffmpeg -i "%~dpn1_te.mp4" -vcodec copy -i "%~dpn1_a.m4a" -acodec copy -y "%~dpn1_out.mp4"
pause
del "%~dpn1_a.m4a"
del "%~dpn1_te.mp4"
2012年01月17日 18点01分 2
level 1
请用-map参数指定
具体原因见ffmpeg文档
3. Stream selection
By default ffmpeg includes only one stream of each type (video, audio, subtitle) present in the input files and adds them to each output file. It picks the "best" of each based upon the following criteria; for video it is the stream with the highest resolution, for audio the stream with the most channels, for subtitle it’s the first subtitle stream. In the case where several streams of the same type rate equally, the lowest numbered stream is chosen.
You can disable some of those defaults by using -vn/-an/-sn options. For full manual control, use the -map option, which disables the defaults just described.

2012年01月17日 19点01分 3
level 8
凝芳文 楼主
嗯,原来要指定才行。二楼那个也是你发的么?试过那个,成功了。看来我想两步完成的想法是太心急了,二楼那样先把视频分离出来就能指定视频流了,好主意!
不过2~3楼是不是同一位发的帖子,反正都大感谢了。
这些编辑视频起来也轻松多了,我可是有60多集这样的动画要转音频。要是用mmg去替换音频再封MP4的话工作量要大不小呢。
2012年01月17日 19点01分 4
level 1
因为这个原因,去年重写direct264gui时,把ffmpeg检查文件信息给加了进去,根据文件信息自动生成-map参数
2012年01月17日 19点01分 5
level 8
凝芳文 楼主
哦,那么如果我去下载roozhou新版的ffmpeg的话,我原来的那个bat也能用了么?
2012年01月17日 19点01分 6
level 1
-map [-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]] (output)
试试
ffmpeg -i "%~1" -vcodec copy -i "%~dpn1_a.aac" -acodec copy -y "%~dpn1_enc.mp4" -map 0:v -map 1:a
2012年01月17日 20点01分 7
非常感谢~~
2013年09月07日 14点09分
level 8
凝芳文 楼主
哈哈,这个也行!顺便请教下,如果我想把源视频在封装完毕后也一并删除要怎么写呢?
我刚才试过写成
del "%~1"
发现它是连封装出来的MP4也一并删除的[瀑布汗~]
2012年01月17日 20点01分 8
level 6
不懂帮顶
2012年01月18日 01点01分 9
level 13
印象中vegas不支持HE-AAC V2,拖进轨道没有波形,播放不出声音。
2012年01月18日 08点01分 10
level 8
凝芳文 楼主
可能是你以前的vegas版本太老不能支持吧。又或者跟你的系统解码环境也有关系呢。我这里导入HE-AAC V2一切正常。
2012年01月18日 08点01分 11
level 13
应该是版本问题,用的是9.0e,以前一直从8.0c用过来的,一直都不支持HE AAC-V2,10.0以上的版本没有试过。
2012年01月18日 11点01分 12
level 8
凝芳文 楼主
哦,这样子的话看来我还是把它改成LC好了,反正本地做素材也不吝啬那么点码率。以防哪天给别人用的时候他的9.0导入不了。
2012年01月18日 11点01分 13
level 9
不是最终素材的话用WAVE就无损了
2015年02月28日 13点02分 14
1