VideoHelp Forum
+ Reply to Thread
Results 1 to 11 of 11
Thread
  1. Member
    Join Date: Dec 2013
    Location: Austin, TX
    Search Comp PM
    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.
    • Copy the video
    • Convert both audio streams from .ogg to .aac
    • Copy the subtitles
    Thank you in advance for any help.



    What I've tried already:
    Code:
    for %%a in ("*.ogm") do ffmpeg -i "%%a" -vcodec copy -acodec copy "newfiles\%%~na.mp4"
    pause
    This just copies video and only 1 audio stream and doesn't copy subtitles.
    Last edited by doomtomb; 29th Dec 2013 at 14:50.
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date: Aug 2000
    Location: Sweden
    Search Comp PM
    You must use the map option, see https://trac.ffmpeg.org/wiki/How%20to%20use%20-map%20option for some examples.
    Quote Quote  
  3. Member
    Join Date: Dec 2013
    Location: Austin, TX
    Search Comp PM
    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
    Quote Quote  
  4. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date: Aug 2000
    Location: Sweden
    Search Comp PM
    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
    Quote Quote  
  5. Member
    Join Date: Dec 2013
    Location: Austin, TX
    Search Comp PM
    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 . . .
    I did as you asked and now I get 1 error:
    Unknown encoder 'libfaac'


    I follow the tutorial http://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.
    Quote Quote  
  6. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date: Aug 2000
    Location: Sweden
    Search Comp PM
    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
    Quote Quote  
  7. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date: Aug 2000
    Location: Sweden
    Search Comp PM
    Try with libvo_aacenc instead of libfaac
    Quote Quote  
  8. Member
    Join Date: Dec 2013
    Location: Austin, TX
    Search Comp PM
    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
    And


    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
    ^ I think I need to convert the subtitles?
    Quote Quote  
  9. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date: Aug 2000
    Location: Sweden
    Search Comp PM
    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.
    Quote Quote  
  10. Member
    Join Date: Dec 2013
    Location: Austin, TX
    Search Comp PM
    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
    for conversion to mov_text from regular txt, a supported mp4 stream.




    Thank you so much.
    Quote Quote  
  11. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date: Aug 2000
    Location: Sweden
    Search Comp PM
    Great!
    Quote Quote  



Similar Threads