VideoHelp Forum
+ Reply to Thread
Results 1 to 3 of 3
Thread
  1. Member
    Join Date
    Jun 2007
    Location
    Canada
    Search Comp PM
    Hi

    In Windows I am using this bat file - I either drag and drop a file on it or select a file and use sendto

    c:\ffmpeg\bin\ffprobe -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams a:0 -show_entries stream=codec_name -i "%~dpnx1"

    c:\ffmpeg\bin\ffprobe -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams v:0 -show_entries stream=codec_name -i "%~dpnx1"

    pause

    this is the output:

    E:\>c:\ffmpeg\bin\ffprobe -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams a:0 -show_entries stream=codec_name -i "E:\Palookaville.mp4"
    streams.stream.0.codec_name="aac"

    E:\>c:\ffmpeg\bin\ffprobe -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams v:0 -show_entries stream=codec_name -i "E:\Palookaville.mp4"
    streams.stream.0.codec_name="h264"

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

    How do I create variable for streams.stream.0.codec_name="aac" and streams.stream.0.codec_name="h264"

    Ideally I want variables for the audio codec name, in this case "aac" and for the video codec name, in this case "h264"


    What I want to do is create a bat file that does the same thing as this Linux script - ffprobe.sh

    #!/bin/bash
    INFO=$(ffprobe -i "$1" -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams a:0 -show_entries stream=codec_name)
    echo $INFO
    b=${INFO:28}
    if [[ "$b" == '"opus"' ]]; then codeca="ogg"; fi
    if [[ "$b" == '"ac3"' ]]; then codeca="ac3"; fi
    if [[ "$b" == '"aac"' ]]; then codeca="m4a"; fi
    if [[ "$b" == '"mp3"' ]]; then codeca="mp3"; fi
    echo demuxed audio file: "${1%.*}.$codeca"
    INFO1=$(ffprobe -i "$1" -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams v:0 -show_entries stream=codec_name)
    echo $INFO1
    c=${INFO1:28}
    if [[ "$c" == '"h264"' ]]; then codecv="m4v"; fi
    if [[ "$c" == '"vp9"' ]]; then codecv="mkv"; fi
    echo demuxed video file: "${1%.*}.$codecv"
    ffmpeg -i "$1" -v quiet -vn -acodec copy "${1%.*}.$codeca"
    ffmpeg -i "$1" -v quiet -an -vcodec copy "${1%.*}.$codecv"
    $SHELL

    In Linux, for the file[s] I want to process I use sendto [in the /usr/share/Thunar/sendto directory I have ffprobe.desktop ]

    this is the output:
    streams.stream.0.codec_name="aac"
    demuxed audio file: /media/unoit/Backup/Palookaville.m4a
    streams.stream.0.codec_name="h264"
    demuxed video file: /media/unoit/Backup/Palookaville.m4v

    TIA
    Quote Quote  
  2. Member
    Join Date
    Jun 2007
    Location
    Canada
    Search Comp PM
    @_Al_

    Thanks for the heads up

    This is my preliminary batch file - ffprobe.bat

    ECHO OFF
    SETLOCAL ENABLEDELAYEDEXPANSION
    set "arg[0]=codec_name"
    C:\ffmpeg\bin\ffprobe.exe -v quiet -select_streams v:0 -show_entries stream=%arg[0]% -of default=noprint_wrappers=1:nokey=1 -i "%~dpnx1" >video.txt
    C:\ffmpeg\bin\ffprobe.exe -v quiet -select_streams a:0 -show_entries stream=%arg[0]% -of default=noprint_wrappers=1:nokey=1 -i "%~dpnx1" >audio.txt
    set /p codecv=<video.txt
    set /p codeca=<audio.txt
    if %codeca% == aac set myaudio=m4a
    if %codeca% == ac3 set myaudio=ac3
    if %codecv% == h264 set myvideo=m4v
    if %codecv% == vp9 set myvideo=mkv
    echo original file is "%~dpnx1"
    echo demuxed audio is "%~dpn1.%myaudio%"
    echo demuxed video is "%~dpn1.%myvideo%"
    c:\ffmpeg\bin\ffmpeg -v quiet -i "%~dpnx1" -vn -c:a copy "%~dpn1.%myaudio%"
    c:\ffmpeg\bin\ffmpeg -v quiet -i "%~dpnx1" -an -c:v copy "%~dpn1.%myvideo%"
    pause


    and the output is

    E:\>ECHO OFF
    original file is "E:\Palookaville.mp4"
    demuxed audio is "E:\Palookaville.m4a"
    demuxed video is "E:\Palookaville.m4v"
    Press any key to continue . . .
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!