折腾:
【未解决】Mac中用ffmpeg调整mp4默认字幕为中文
期间,用:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ➜ ffmpeg_edit_subtitle ffmpeg - i CTT_Folge_01_CH_Subs_DefaultZhcnButNotShow.mp4 - vf "ass=subtitle.ass" addedAssSubtitle.mp4 ffmpeg version 3.4 . 2 Copyright (c) 2000 - 2018 the FFmpeg developers built with Apple LLVM version 9.0 . 0 (clang - 900.0 . 39.2 ) configuration: - - prefix = / usr / local / Cellar / ffmpeg / 3.4 . 2 - - enable - shared - - enable - pthreads - - enable - version3 - - enable - hardcoded - tables - - enable - avresample - - cc = clang - - host - cflags = - - host - ldflags = - - disable - jack - - enable - gpl - - enable - libmp3lame - - enable - libx264 - - enable - libxvid - - enable - opencl - - enable - videotoolbox - - disable - lzma libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107 . 100 / 57.107 . 100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107 . 100 / 6.107 . 100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'CTT_Folge_01_CH_Subs_DefaultZhcnButNotShow.mp4': Metadata: major_brand : mp42 minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 2018 - 10 - 13T03 : 27 : 31.000000Z encoder : HandBrake 1.1 . 2 2018090500 Duration: 00 : 26 : 52.03 , start: - 0.001333 , bitrate: 1762 kb / s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1599 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default) Metadata: creation_time : 2018 - 10 - 13T03 : 27 : 31.000000Z handler_name : VideoHandler Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 157 kb/s (default) Metadata: creation_time : 2018 - 10 - 13T03 : 27 : 31.000000Z handler_name : Stereo Stream #0:2(zho): Subtitle: mov_text (tx3g / 0x67337874), 1280x108, 0 kb/s (default) Metadata: creation_time : 2018 - 10 - 13T03 : 27 : 31.000000Z handler_name : SubtitleHandler Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (aac (native) -> aac (native)) Press [q] to stop, [?] for help [AVFilterGraph @ 0x7fa224608740 ] No such filter : 'ass' Error reinitializing filters! Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #0:0 [aac @ 0x7fa226032a00 ] Qavg: 42469.492 [aac @ 0x7fa226032a00 ] 2 frames left in the queue on closing Conversion failed! ➜ ffmpeg_edit_subtitle |
出错:
[AVFilterGraph @ 0x7fa224608740] No such filter: ‘ass’
-》之前也遇到类似错误:
[AVFilterGraph @ 0x7fc399d0a980] No such filter: ‘subtitles’
-》看来mp4,即没有subtitles,也有没ass的filter
再去试试
-vf ass=subtitles.ass
-》看到人说了:
“Use the libass library (make sure your ffmpeg install has the library in the configuration –enable-libass).”
-》发现和上面的错误是一个意思
-》不过,从之前的ffmpeg的输出看,此处的ffmpeg没有:enable-libass
所以现在是:
已经用了:
1 | ffmpeg -i CTT_Folge_01_CH_Subs_DefaultZhcnButNotShow.mp4 -i subtitle.srt -c copy -c:s mov_text movTextSubtitle.mp4 |
把srt的字幕 添加到mp4了
-》但是还是只是subtitle stream,而不是burned in=embed=嵌入
-》想要嵌入,则需要用:
1 | -vf ass=subtitles.ass |
但是此处没有ass的filter
-》需要去想办法给ffmpeg添加enable-libass
自己去编译?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | ➜ ffmpeg_edit_subtitle brew info ffmpeg ffmpeg: stable 3.4.2 (bottled), HEAD Play, record, convert, and stream audio and video https: //ffmpeg .org/ /usr/local/Cellar/ffmpeg/3 .4.2 (248 files, 50.9MB) * Poured from bottle on 2018-04-17 at 10:51:58 From: https: //mirrors .ustc.edu.cn /homebrew-core .git /Formula/ffmpeg .rb ==> Dependencies Build: nasm ✘, pkg-config ✔, texi2html ✘ Recommended: lame ✔, x264 ✔, xvid ✔ Optional: chromaprint ✘, fdk-aac ✘, fontconfig ✘, freetype ✘, frei0r ✘, game-music-emu ✘, libass ✘, libbluray ✘, libbs2b ✘, libcaca ✘, libgsm ✘, libmodplug ✘, librsvg ✘, libsoxr ✘, libssh ✘, libvidstab ✘, libvorbis ✘, libvpx ✘, opencore-amr ✘, openh264 ✘, openjpeg ✘, openssl ✔, opus ✘, rtmpdump ✘, rubberband ✘, sdl2 ✘, snappy ✘, speex ✘, tesseract ✘, theora ✘, two-lame ✘, wavpack ✘, webp ✘, x265 ✘, xz ✔, zeromq ✘, zimg ✘ ==> Options --with-chromaprint Enable the Chromaprint audio fingerprinting library --with-fdk-aac Enable the Fraunhofer FDK AAC library --with-fontconfig Build with fontconfig support --with-freetype Build with freetype support --with-frei0r Build with frei0r support --with-game-music-emu Build with game-music-emu support --with-libass Enable ASS /SSA subtitle format --with-libbluray Build with libbluray support --with-libbs2b Build with libbs2b support --with-libcaca Build with libcaca support --with-libgsm Build with libgsm support --with-libmodplug Build with libmodplug support --with-librsvg Enable SVG files as inputs via librsvg --with-libsoxr Enable the soxr resample library --with-libssh Enable SFTP protocol via libssh --with-libvidstab Enable vid.stab support for video stabilization --with-libvorbis Build with libvorbis support --with-libvpx Build with libvpx support --with-opencore-amr Enable Opencore AMR NR /WB audio format --with-openh264 Enable OpenH264 library --with-openjpeg Enable JPEG 2000 image format --with-openssl Enable SSL support --with-opus Build with opus support --with-rtmpdump Enable RTMP protocol --with-rubberband Enable rubberband library --with-sdl2 Enable FFplay media player --with-snappy Enable Snappy library --with-speex Build with speex support --with-tesseract Enable the tesseract OCR engine --with-theora Build with theora support --with-tools Enable additional FFmpeg tools --with-two-lame Build with two-lame support --with-wavpack Build with wavpack support --with-webp Enable using libwebp to encode WEBP images --with-x265 Enable x265 encoder --with-xz Enable decoding of LZMA-compressed TIFF files --with-zeromq Enable using libzeromq to receive commands sent through a libzeromq client --with-zimg Enable z.lib zimg library --without-gpl Disable building GPL licensed parts of FFmpeg --without-lame Disable MP3 encoder --without-qtkit Disable deprecated QuickTime framework --without-securetransport Disable use of SecureTransport --without-x264 Disable H.264 encoder --without-xvid Disable Xvid MPEG-4 video encoder --HEAD Install HEAD version |
所以此处是:
libass,没有开启。
去参考示例,开启:
1 2 3 4 5 6 7 8 9 10 | brew install ffmpeg \ --with-tools \ --with-fdk-aac \ --with-freetype \ --with-fontconfig \ --with-libass \ --with-libvorbis \ --with-libvpx \ --with-opus \ --with-x265 |
结果提示:
1 2 3 4 5 6 7 8 9 10 11 12 13 | ➜ ffmpeg_edit_subtitle brew install ffmpeg \ --with-tools \ --with-fdk-aac \ --with-freetype \ --with-fontconfig \ --with-libass \ --with-libvorbis \ --with-libvpx \ --with-opus \ --with-x265 Updating Homebrew... Warning: ffmpeg 3.4.2 is already installed and up-to- date To reinstall 3.4.2, run `brew reinstall ffmpeg |
需要重新安装ffmpeg。
那就重新安装,加上那些参数,结果:
【已解决】Mac中brew reinstall ffmpeg出错:Error: Calling keg_only :provided_pre_mountain_lion is disabled! There is no replacement
然后就支持了ass。
转载请注明:在路上 » 【已解决】Mac中尝试给mp4内嵌字幕出错:AVFilterGraph No such filter ass