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

    I have been using this ffmpeg batch file to check for video errors

    c:\ffmpeg\bin\ffmpeg -v error -i "%~dpnx1" -f null - >"%~dpnx1.error.txt" 2>&1
    pause

    I just drag and drop a file or folder onto the .bat file

    Can someone convert this to a Linux shell script

    TIA
    Last edited by wiseant; 30th Aug 2023 at 18:45. Reason: spelling
    Quote Quote  
  2. Mr. Computer Geek dannyboy48888's Avatar
    Join Date
    May 2007
    Location
    Texas, USA
    Search Comp PM
    #!/bin/bash
    SAVEIFS=$IFS
    for file in $*
    do
    ffmpeg -v error -i $file -f null - > $file.log
    done
    IFS=$SAVEIFS

    Save as whatever.sh to run do sh whatever.sh file.mkv

    To have dragband drop you need a whatever.desktop file. It doesn't have to actually be on the desktop. Example one chance to whatever you are the script as. On my phone so will clean up more later.

    [Desktop Entry]
    Type=Application
    Name=ac-3 2 channel
    GenericName[en]=ac-3 2 channel
    Comment=ffmpeg convert to 256k 2 channel AC-3
    Icon=ac3
    Exec=sh /home/witzel/Desktop/work/ffmpeg-ac3-256k-2ch-out.sh %F
    Terminal=true
    Categories=Audio
    Keywords=audio;avisynth
    if all else fails read the manual
    Quote Quote  
  3. Member
    Join Date
    Jun 2007
    Location
    Canada
    Search Comp PM
    @dannyboy48888

    Thank you for taking the time to reply

    I was able to figure it out - here is my script

    for mediafile in *.mkv *.mp4; do
    echo $mediafile
    ffmpeg -v error -i "$mediafile" -f null - >"$mediafile.error.txt" 2>&1
    echo "finished error-check on $mediafile"
    done
    echo "all done"
    $SHELL

    and I did create a desktop file:
    [Desktop Entry]
    Encoding=UTF-8
    Name=Drop Over Me
    Comment=Execute the script with the file dropped
    Exec=xfce4-terminal -e "/home/unoit/Downloads/auto_ffmpeg.sh"
    Icon=utilities-terminal
    Type=Application
    Terminal=true
    StartupNotify=true

    I am not entirely sure what entries I should and should not have in my file.desktop

    In Linux Mint I can drag a mp4 or mkv video from a directory to my desktop file and it will error-check all of the mp4 and mkv files

    However this does not work for me in antiX distro - here I have to have the script in the same folder as my videos and I can double-click the script or run it from the terminal

    In your desktop file for the Exec entry you are using %F - what does this do?
    Quote Quote  
  4. Mr. Computer Geek dannyboy48888's Avatar
    Join Date
    May 2007
    Location
    Texas, USA
    Search Comp PM
    The %F passes all file names to the script when you drop a list on the desktop file. %f would do one process per filename (you don't want that). Without %F the desktop file won't work as it's not passing a name to the script to process. Sorry about the late reply will write you a script/desktop file if needed. Works on xfce in my case
    if all else fails read the manual
    Quote Quote  
  5. Member
    Join Date
    Jun 2007
    Location
    Canada
    Search Comp PM
    @dannyboy48888

    In order to work using antiX distro, my scripts need to be in the same directory as my video files - then I double-click the .sh file and it processed the videos in that directory - or I can run this:

    cd /media/Backup/Walking; ./demux_audio.sh in terminal - or drag and drop demux_audio.sh to terminal


    I have five scripts that I use - it would be easier if I could just drag and drop the folder or one file if it will also process the other relevant files

    here is my demux_audo.sh:

    for mediafile in *.mp4; do
    echo $mediafile
    ffmpeg -i "$mediafile" -vn -acodec copy "${mediafile%.mp4}.m4a"
    echo "finished demuxing $mediafile"
    done
    $Shell

    I made a .desktop file for demux_audio.sh
    [Desktop Entry]
    Type=Application
    Name=DemuxAudio
    Comment=demux audio from video file[s]
    Icon=utilities-terminal
    Exec=sh /media/Backup/Walking/demux_audio.sh %F
    Terminal=true

    when I drag the video folder onto demux_audio.desktop - "Failed to execute child process 'xterm" (No such file or directory"

    when I drag a video file onto demux_audio.desktop - "Failed to execute child process 'xterm" (No such file or directory"

    TIA
    Last edited by wiseant; 2nd Sep 2023 at 18:28. Reason: add info
    Quote Quote  



Similar Threads

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