Hello,
I have a lot of Anime in the old .ogm format (I think because it was the first dual audio stream container? correct me if I'm wrong). I am trying to batch convert this to .mp4 except I have no experience writing command line ffmpeg.
Thank you in advance for any help.
- Copy the video
- Convert both audio streams from .ogg to .aac
- Copy the subtitles
What I've tried already:
This just copies video and only 1 audio stream and doesn't copy subtitles.Code:for %%a in ("*.ogm") do ffmpeg -i "%%a" -vcodec copy -acodec copy "newfiles\%%~na.mp4" pause
+ Reply to Thread
Results 1 to 11 of 11
-
Last edited by doomtomb; 29th Dec 2013 at 14:50.
-
You must use the map option, see https://trac.ffmpeg.org/wiki/How%20to%20use%20-map%20option for some examples.
-
Ok, so that's getting me on the right track... but now I'm left with something like this and getting errors regarding invalid filename syntax:
Code:for %%a in ("*.ogm") do ffmpeg -i "%%a" \ -map 0:0 -map 0:1 -map 0:2 -map 0:3 \ -c:v copy \ -c:a:0 libfaac -b:a:0 96k \ -c:a:1 libfaac -b:a:1 96k \ -c:s copy \ "newfiles\%%~na.mp4" pause
-
Post the error output
and don't use any \ or new line.
Code:for %%a in ("*.ogm") do ffmpeg -i "%%a" -map 0:0 -map 0:1 -map 0:2 -map 0:3 -c:v copy -c:a:0 libfaac -b:a:0 96k -c:a:1 libfaac -b:a:1 96k -c:s copy "newfiles\%%~na.mp4" pause
-
It's not exactly easy or pretty
Code:F:\Videos\Anime\Rurouni Kenshin (1-95 Dual Audio)\Season 2>ffmpeg -i "60 - The Man Who is Chosen for Victory.ogm" \ ffmpeg version N-59407-gfead241 Copyright (c) 2000-2013 the FFmpeg developers built on Dec 28 2013 22:01:59 with gcc 4.8.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 59.100 / 52. 59.100 libavcodec 55. 47.100 / 55. 47.100 libavformat 55. 22.100 / 55. 22.100 libavdevice 55. 5.102 / 55. 5.102 libavfilter 4. 0.103 / 4. 0.103 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 libpostproc 52. 3.100 / 52. 3.100 Input #0, ogg, from '60 - The Man Who is Chosen for Victory.ogm': Duration: 00:25:42.88, start: 0.000000, bitrate: 1265 kb/s Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 640x480, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc Metadata: TITLE : [a4e]Rurouni_Kenshin_TV_60[divx5.1.1].ogm Stream #0:1(English): Audio: vorbis, 48000 Hz, stereo, fltp, 104 kb/s Stream #0:2(Japanese): Audio: vorbis, 48000 Hz, stereo, fltp, 100 kb/s Stream #0:3(English): Subtitle: text [NULL @ 0490d700] Unable to find a suitable output format for '\' \: Invalid argument F:\Videos\Anime\Rurouni Kenshin (1-95 Dual Audio)\Season 2>ffmpeg -i "61 - The Juppongatana Who Remain (aka The Choice for Life).ogm" \ ffmpeg version N-59407-gfead241 Copyright (c) 2000-2013 the FFmpeg developers built on Dec 28 2013 22:01:59 with gcc 4.8.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 59.100 / 52. 59.100 libavcodec 55. 47.100 / 55. 47.100 libavformat 55. 22.100 / 55. 22.100 libavdevice 55. 5.102 / 55. 5.102 libavfilter 4. 0.103 / 4. 0.103 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 libpostproc 52. 3.100 / 52. 3.100 Input #0, ogg, from '61 - The Juppongatana Who Remain (aka The Choice for Life).ogm': Duration: 00:25:41.02, start: 0.000000, bitrate: 1267 kb/s Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 640x480, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc Metadata: TITLE : [a4e]Rurouni_Kenshin_TV_61[divx5.1.1].ogm Stream #0:1(English): Audio: vorbis, 48000 Hz, stereo, fltp, 104 kb/s Stream #0:2(Japanese): Audio: vorbis, 48000 Hz, stereo, fltp, 100 kb/s Stream #0:3(English): Subtitle: text [NULL @ 0033f7e0] Unable to find a suitable output format for '\' \: Invalid argument F:\Videos\Anime\Rurouni Kenshin (1-95 Dual Audio)\Season 2>ffmpeg -i "62 - Kyoto, the Engraved Memory.ogm" \ ffmpeg version N-59407-gfead241 Copyright (c) 2000-2013 the FFmpeg developers built on Dec 28 2013 22:01:59 with gcc 4.8.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 59.100 / 52. 59.100 libavcodec 55. 47.100 / 55. 47.100 libavformat 55. 22.100 / 55. 22.100 libavdevice 55. 5.102 / 55. 5.102 libavfilter 4. 0.103 / 4. 0.103 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 libpostproc 52. 3.100 / 52. 3.100 Input #0, ogg, from '62 - Kyoto, the Engraved Memory.ogm': Duration: 00:25:47.34, start: 0.000000, bitrate: 1264 kb/s Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 640x480, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc Metadata: TITLE : [a4e]Rurouni_Kenshin_TV_62[divx5.1.1].ogm Stream #0:1(English): Audio: vorbis, 48000 Hz, stereo, fltp, 104 kb/s Stream #0:2(Japanese): Audio: vorbis, 48000 Hz, stereo, fltp, 100 kb/s Stream #0:3(English): Subtitle: text [NULL @ 0258ea80] Unable to find a suitable output format for '\' \: Invalid argument F:\Videos\Anime\Rurouni Kenshin (1-95 Dual Audio)\Season 2>-map 0:0 -map 0:1 -map 0:2 -map 0:3 \ '-map' is not recognized as an internal or external command, operable program or batch file. F:\Videos\Anime\Rurouni Kenshin (1-95 Dual Audio)\Season 2>-c:v copy \ The filename, directory name, or volume label syntax is incorrect. F:\Videos\Anime\Rurouni Kenshin (1-95 Dual Audio)\Season 2>-c:a:0 libfaac -b:a:0 96k \ The filename, directory name, or volume label syntax is incorrect. F:\Videos\Anime\Rurouni Kenshin (1-95 Dual Audio)\Season 2>-c:a:1 libfaac -b:a:1 96k \ The filename, directory name, or volume label syntax is incorrect. F:\Videos\Anime\Rurouni Kenshin (1-95 Dual Audio)\Season 2>-c:s copy \ The filename, directory name, or volume label syntax is incorrect. F:\Videos\Anime\Rurouni Kenshin (1-95 Dual Audio)\Season 2>"newfiles\%~na.mp4" '"newfiles\%~na.mp4"' is not recognized as an internal or external command, operable program or batch file. F:\Videos\Anime\Rurouni Kenshin (1-95 Dual Audio)\Season 2>pause Press any key to continue . . .
Unknown encoder 'libfaac'
I follow the tutorial https://forum.videohelp.com/threads/356314-How-to-batch-convert-multiplex-any-files-with-ffmpeg so all I have is ffmpeg.exe and the bat file and the videos. -
Remove the line breaks and \.
Code:for %%a in ("*.ogm") do ffmpeg -i "%%a" -map 0:0 -map 0:1 -map 0:2 -map 0:3 -c:v copy -c:a:0 libfaac -b:a:0 96k -c:a:1 libfaac -b:a:1 96k -c:s copy "newfiles\%%~na.mp4" pause
-
Thanks, but still two errors remaining... it all has to do with the filename writing
Code:Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred
Code:Stream #0:3(English): Subtitle: text [mp4 @ 02617820] Could not find tag for codec text in stream #3, codec not curre ntly supported in container
-
Try without any any batch first. Just one file. And see if you get any errors.
And the subtitle stream copy might not work in a mp4 container. -
It's working away perfectly now.
my final code is:
Code:for %%a in ("*.ogm") do ffmpeg -i "%%a" -map 0:0 -map 0:1 -map 0:2 -map 0:3 -c:v copy -c:a:0 libvo_aacenc -b:a:0 96k -c:a:1 libvo_aacenc -b:a:1 96k -c:s mov_text "newfiles\%%~na.mp4" pause
I just had to specify:
Code:-c:s mov_text
Thank you so much.
Similar Threads
-
Could someone change this .sh Linux script into a usable .bat? (ffmpeg)
By RabblerouserGT in forum Video Streaming DownloadingReplies: 11Last Post: 8th Feb 2013, 14:43 -
How to open MP4,MKV,WMV,RM,MOV,OGM with any editor,encoder
By Baldrick in forum User guidesReplies: 78Last Post: 24th Feb 2011, 09:53 -
ffmpeg help... convert mp4 to jpeg array, and back to mp4 - problem!
By SaskVideoMaker in forum Video ConversionReplies: 2Last Post: 4th Feb 2011, 04:53 -
Help with FFmpeg .TS to .mp4
By ViM in forum Video ConversionReplies: 2Last Post: 15th Nov 2010, 10:39 -
How to convert OGM to MP4
By LukeGuldan in forum Video ConversionReplies: 12Last Post: 26th Nov 2009, 15:11