Momo707577045 / media-source-extract

MediaSource 视频提取教程
1.59k stars 458 forks source link

Windows下合并音视频脚本 #46

Open ruin1990 opened 2 years ago

ruin1990 commented 2 years ago

使用方法就是下载每次不都是xxx.mp4和xxx (1).mp4,把2个文件丢一起然后bat和ffmpeg.exe丢一起,xxx.mp4丢bat上就行了 下面内容保存为bat

@echo off
REM 读取第一个参数
SET param=%1
REM 不论param有没有双引号,都给其加上
SET param="%param%"
REM 将param中的所有双引号删除
SET param=%param:"=%
REM 给没有双引号的param加上双引号
rem SET param="%param%"

set filename=%param%
set filename=%filename:~0,-4%
set audio_file="%filename%.mp4"
set aac_file="%filename%.aac"
set video_file="%filename% (1).mp4"
set result_file="%filename%_merged.mp4"
echo %filename%
echo %audio_file%
echo %aac_file%
echo %video_file%

echo 1.export aac audio
rem 先把音频分离出来
rem ffmpeg -i "audio.m4a" -acodec copy "tmp_audio.aac"
ffmpeg -i %audio_file% -acodec copy %aac_file%
echo 2.merge aac and video
rem 然后把原始视频和上一步得到的aac组装到一起
rem ffmpeg -i "video.mp4" -i "tmp_audio.aac" -c copy -shortest "output.mp4"
ffmpeg -i %video_file% -i %aac_file% -c copy -shortest %result_file%
echo finish
pause

https://github.com/nilaoda/N_m3u8DL-CLI/releases/download/3.0.2/N_m3u8DL-CLI_v3.0.2_with_ffmpeg_and_SimpleG.zip 这里面有带个ffmpeg.exe我试了下可用

AOALI123 commented 2 years ago

合并以后有可能会造成视频画面卡主不动的情况

AOALI123 commented 2 years ago

合并以后有可能会造成视频画面卡主不动的情况

经过测试 是视频文件有问题 提取的视频文件可能会有编码不对之类的问题 不论FFMPEG还是小丸均无法合并(FFMPEG合并后视频卡住) 解决方法是先把视频在小丸X264压一遍 音频用小丸提取出AAC 然后再去小丸合并 就可成功 参考资料:https://www.cnbeining.com/2017/10/1211/

hexwarrior6 commented 2 years ago
~0,-4
"~0,-4.mp4"                                                                                                             "~0,-4.mp4"
"~0,-4.aac"
"~0,-4 (1).mp4"
1.export aac audio
ffmpeg version N-108614-g37ee36f689-20221011 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20221011
  libavutil      57. 39.100 / 57. 39.100
  libavcodec     59. 50.100 / 59. 50.100
  libavformat    59. 34.101 / 59. 34.101
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 49.101 /  8. 49.101
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
~0,-4.mp4: No such file or directory
ffmpeg version N-108614-g37ee36f689-20221011 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20221011
  libavutil      57. 39.100 / 57. 39.100
  libavcodec     59. 50.100 / 59. 50.100
  libavformat    59. 34.101 / 59. 34.101
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 49.101 /  8. 49.101
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
~0,-4 (1).mp4: No such file or directory
finish
请按任意键继续. . .

这是为什么

zhu2842412606 commented 1 year ago

同问

zzy5111398 commented 8 months ago

同问

看具体操作,把mp4文件丢到bat上。