Author Topic: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script  (Read 4550 times)

dosdan

  • Full Member
  • ***
  • Posts: 113
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #45 on: March 27, 2018, 10:24:14 AM »
Perhaps your version of FFPROBE is returning a different string e.g. AC3 or AC-3 instead of ac3. To troubleshoot, try a simpler command on the cmd line, not a batchfile, with a media file that you already know contains an AC-3 audio stream  e.g. try just:

ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "d:\20161130 - OIC Christmas Carols\Video\00000.MTS"

I see:
Code: [Select]
codec_name=h264
codec_name=ac3
codec_name=hdmv_pgs_subtitle
codec_name=h264
codec_name=ac3
codec_name=hdmv_pgs_subtitle

Dan.

jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #46 on: March 27, 2018, 10:32:08 AM »
I get this

C:\Users\jonwr>ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1"C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4"
[default @ 000002d4adc36f20]
Failed to parse option string 'noprint_wrappers=1C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4' provided to writer context

dosdan

  • Full Member
  • ***
  • Posts: 113
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #47 on: March 27, 2018, 10:38:34 AM »
I get this

C:\Users\jonwr>ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1"C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4"
[default @ 000002d4adc36f20]
Failed to parse option string 'noprint_wrappers=1C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4' provided to writer context

Add a space before the media filename i.e.
ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4"


jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #48 on: March 27, 2018, 10:44:10 AM »
I now get this  :)

C:\Users\jonwr>ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4"
codec_name=h264
codec_name=ac3

dosdan

  • Full Member
  • ***
  • Posts: 113
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #49 on: March 27, 2018, 10:51:50 AM »
I now get this  :)

C:\Users\jonwr>ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4"
codec_name=h264
codec_name=ac3

OK, now try this (command on one line):

ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4" | find "ac3"


If that works increase it to (command on one line):

ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4" | find "ac3"  >nul && echo  "C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4" contains AC3

Dan.

jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #50 on: March 27, 2018, 10:56:35 AM »
ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4" | find "ac3"

I get...codec_name=ac3

ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4" | find "ac3"  >nul && echo  "C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4" contains AC3

I get..."C:\Users\jonwr\Desktop\Dark Net - 2x01 - My Mind.mp4" contains AC3

dosdan

  • Full Member
  • ***
  • Posts: 113
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #51 on: March 27, 2018, 11:09:37 AM »
So the basic command is working fine. The problem must be in the FOR IN () DO loop.

Try this batch file:

Find_AC3.bat
Code: [Select]
@echo on
cls
for %%F in (%*) do (
ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "%%~dpnxF"  | find "ac3">nul && echo "%%~dpnxF" contains AC3
shift
)
pause

use it from the cmd line with a file containing AC-3. Since ECHO is ON you will see the lines in the batch file, and then you will see them again, this time with the FOR IN () DO loop interpreted and "%%~dpnxF" expanded:

D:\>Find_AC3.bat "D:\MKV test\test 100.mkv"

I see:
Code: [Select]
D:\>for %F in ("D:\MKV test\test 100.mkv") do (
ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "%~dpnxF"    | find "ac3"  1>nul  && echo "%~dpnxF" contains AC3
 shift
)

D:\>(
ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "D:\MKV test\test 100.mkv"    | find "ac3"  1>nul  && echo "D:\MKV test\test 100.mkv" contains AC3
 shift
)

D:\>pause
Press any key to continue . . .



« Last Edit: March 27, 2018, 11:19:03 AM by dosdan »

jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #52 on: March 27, 2018, 11:18:53 AM »
@echo on
cls
for %%F in (%*) do (
   ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "%%~dpnxF"  | find "ac3">nul && echo "%%~dpnxF" contains AC3
   shift
)
pause

I get....
C:\Users\jonwr>for %%F in (%*) do (
%%F was unexpected at this time.

C:\Users\jonwr>ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "%%~dpnxF"  | find "ac3">nul && echo "%%~dpnxF" contains AC3
%%~dpnxF: No such file or directory

C:\Users\jonwr>shift

dosdan

  • Full Member
  • ***
  • Posts: 113
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #53 on: March 27, 2018, 11:25:20 AM »
I get....
C:\Users\jonwr>for %%F in (%*) do (
%%F was unexpected at this time.

That's unusual. In a batch file, (but not at the cmd line), you need to use the double percentage symbols: %%F

But when the batchfile is run, the first percentage symbol is stripped off, leaving just %F

Notice how mine is doing this and yours is not.

« Last Edit: March 27, 2018, 11:30:25 AM by dosdan »

jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #54 on: March 27, 2018, 11:29:58 AM »
Just my luck, this has to happen to me lol

dosdan

  • Full Member
  • ***
  • Posts: 113
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #55 on: March 27, 2018, 11:31:05 AM »
The same applies to %*

Mine is immediately changed to the command line parameters following the batchfile name, here just a single media file. Again this behaviour is expected inside a batch file as compared to issuing the command at the cmd prompt.

Dan.

jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #56 on: March 27, 2018, 11:32:39 AM »
This is what am getting in a Batch now...

C:\Users\jonwr\Desktop>for %F in ((null)) do (
ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "%~dpnxF"    | find "ac3"  1>nul  && echo "%~dpnxF" contains AC3
 shift
)

C:\Users\jonwr\Desktop>pause
Press any key to continue . . .

dosdan

  • Full Member
  • ***
  • Posts: 113
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #57 on: March 27, 2018, 11:40:40 AM »
Try this. Create this batch file in a text editor:

Batch_Paramenter_Parsing.bat
Code: [Select]
@echo off
echo %%1 is %1
echo %%2 is %2
echo %%3 is %3
echo %%4 is %4
echo %%* is %*

Run it from the cmd prompt with some parameters:
D:\>batch_parameter_parsing.bat 10 20 30 40 50 60 70 80 90

I see:
Code: [Select]
%1 is 10
%2 is 20
%3 is 30
%4 is 40
%* is 10 20 30 40 50 60 70 80 90

Dan.
« Last Edit: March 27, 2018, 11:43:50 AM by dosdan »

jonwren

  • Jr. Member
  • **
  • Posts: 59
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #58 on: March 27, 2018, 11:49:18 AM »
C:\Users\jonwr>C:\>batch_parameter_parsing.bat 10 20 30 40 50 60 70 80 90
'C:\' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\jonwr>
« Last Edit: March 27, 2018, 11:52:25 AM by jonwren »

dosdan

  • Full Member
  • ***
  • Posts: 113
Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Reply #59 on: March 27, 2018, 11:58:51 AM »
C:\Users\jonwr>C:\>batch_parameter_parsing.bat 10 20 30 40 50 60 70 80 90
'C:\' is not recognized as an internal or external command,
operable program or batch file.

No, use:
batch_parameter_parsing.bat 10 20 30 40 50 60 70 80 90