Skip to main content
deleted 213 characters in body
Source Link
kram
  • 11
  • 2

Here is my scriptI updated it a little bit, but I'm still not getting the results I should be getting:

#!/bin/bash
 
#convert stuff tofind MPEG4"$1" /-type 2chf AAC


for| fwhile inread /movies_input/*filename
do
videoCodec=""
audioCodec=""
audioChannels=""
#echo "process $f"
videoCodec=$(mediainfo --Inform="Video;%Codec%" $f)
audioCodec=$videoCodec=$(mediainfoffprobe --Inform="Audio;%Codec%"v $f)
audioChannels=$(mediainfoerror --Inform="Audio;%Channels%"select_streams $f)
#mediainfov:0 --Inform="Video;%Codec%" $fshow_entries |stream=codec_name while-of readdefault=noprint_wrappers=1:nokey=1 line;
video_good="false"
audio_good="false"
"$filename")
if [[ $videoCodec == "V_MPEG4"*audioCodec=$(ffprobe ]]-v ;error then
-select_streams a:0 -show_entries stream=codec_name cli_video="-c:vof copydefault=noprint_wrappers=1:nokey=1 ""$filename")
    video_good="true"
fi

if [[ $audioCodecaudioChannels=$(ffprobe ==-v "AAC"error &&-select_streams $audioChannelsa:0 ==-show_entries "2"stream=channels ]]-of ;default=noprint_wrappers=1:nokey=1 then"$filename")

    cli_audio="-c:aecho copy$videoCodec "
$audioCodec $audioChannels $filename

  audio_good="true"
#  if [ $videoCodec = "h264" else
#] && [ cli_audio="-c:a$audioCodec aac= -ac"aac" 2] "
fi

if&& [[[ $video_good="true"audioChannels &&= $audio_good="true""2" ]]] ; then
    echo "I'm going to execute:"
    echo ffmpeg"Direct -iplay $fcapable"
 $cli_video $cli_audio `basename "$f"`
fi

done
done

When I run this script,on a folder containing a file which has 6 channel AAC will runthat meets all the "I'm going to execute:" codeif conditions ("h264 aac 2 . When run a file which is DTS audio it will run/Black.Mass.(2015)/Black.Mass.(2015).mp4") but do not get the "I'm going to execute:" code"Direct play capable" echo.

Please help! thanks

Here is my script:

#!/bin/bash
 
#convert stuff to MPEG4 / 2ch AAC


for f in /movies_input/*
do
videoCodec=""
audioCodec=""
audioChannels=""
#echo "process $f"
videoCodec=$(mediainfo --Inform="Video;%Codec%" $f)
audioCodec=$(mediainfo --Inform="Audio;%Codec%" $f)
audioChannels=$(mediainfo --Inform="Audio;%Channels%" $f)
#mediainfo --Inform="Video;%Codec%" $f | while read line;
video_good="false"
audio_good="false"

if [[ $videoCodec == "V_MPEG4"* ]] ; then
    cli_video="-c:v copy "
    video_good="true"
fi

if [[ $audioCodec == "AAC" && $audioChannels == "2" ]] ; then
    cli_audio="-c:a copy "
    audio_good="true"
#       else
#   cli_audio="-c:a aac -ac 2 "
fi

if [[ $video_good="true" && $audio_good="true" ]] ; then
    echo "I'm going to execute:"
    echo ffmpeg -i $f $cli_video $cli_audio `basename "$f"`
fi

done
done

When I run this script, a file which has 6 channel AAC will run the "I'm going to execute:" code. When run a file which is DTS audio it will run the "I'm going to execute:" code.

Please help! thanks

I updated it a little bit, but I'm still not getting the results I should be getting:

#!/bin/bash
find "$1" -type f | while read filename
do

    videoCodec=$(ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$filename")
    audioCodec=$(ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$filename")
    audioChannels=$(ffprobe -v error -select_streams a:0 -show_entries stream=channels -of default=noprint_wrappers=1:nokey=1 "$filename")

    echo $videoCodec $audioCodec $audioChannels $filename

    if [ $videoCodec = "h264" ] && [ $audioCodec = "aac" ] && [ audioChannels = "2" ] ; then
        echo "Direct play capable"
    fi

done

I run this on a folder containing a file that meets all the if conditions ("h264 aac 2 ./Black.Mass.(2015)/Black.Mass.(2015).mp4") but do not get the "Direct play capable" echo.

Source Link
kram
  • 11
  • 2

bash script variables not proper

Here is my script:

#!/bin/bash

#convert stuff to MPEG4 / 2ch AAC


for f in /movies_input/*
do
videoCodec=""
audioCodec=""
audioChannels=""
#echo "process $f"
videoCodec=$(mediainfo --Inform="Video;%Codec%" $f)
audioCodec=$(mediainfo --Inform="Audio;%Codec%" $f)
audioChannels=$(mediainfo --Inform="Audio;%Channels%" $f)
#mediainfo --Inform="Video;%Codec%" $f | while read line;
video_good="false"
audio_good="false"

if [[ $videoCodec == "V_MPEG4"* ]] ; then
    cli_video="-c:v copy "
    video_good="true"
fi

if [[ $audioCodec == "AAC" && $audioChannels == "2" ]] ; then
    cli_audio="-c:a copy "
    audio_good="true"
#       else
#   cli_audio="-c:a aac -ac 2 "
fi

if [[ $video_good="true" && $audio_good="true" ]] ; then
    echo "I'm going to execute:"
    echo ffmpeg -i $f $cli_video $cli_audio `basename "$f"`
fi

done
done

When I run this script, a file which has 6 channel AAC will run the "I'm going to execute:" code. When run a file which is DTS audio it will run the "I'm going to execute:" code.

Please help! thanks