Quantcast
Channel: MediaSPIP
Viewing all articles
Browse latest Browse all 118075

FFMPEG convert videos using Automator

$
0
0

I'm trying to use Apple Automator to select a folder and convert all MP4 files to WMV files using FFMPEG but I'm getting an output error and I'm not finding how to solve the issue :(

FFMPEG is installed via Homebrew and the folder was found via "which ffmpeg".

This is the worklow I currently have: Full Automator Workflow

  1. Run AppleScript

    1. tell application "System Events"
       activate
       return text returned of (display dialog "Enter administrator password" default answer "" with hidden answer)
      end tell
      
  2. Run Shell script (/bin/zsh, no input required)

    1. sudo -S id -u
      
  3. Ask for Finder elements

    1. Select folder, starting from "Downloads" folder, no multiple selection
  4. Run Shell script (/bin/zsh, input as arguments)

    1. cd "$1"
      
      for f in *.mp4; do
       osascript -e "display notification \"Converting file: $f \" with title \"Video Conversion\""
       sudo /opt/homebrew/bin/ffmpeg -i "$f" -c:v wmv2 -b:v 3000k -c:a wmav2 -b:c 192k "${f%.*}.wmv"
       if [ $? -eq 0 ]; then
       osascript -e "display notification \"Converted file: $f \" with title \"Video Conversion\""
       else
       osascript -e "display notification \"Error converting file: $f \" with title \"Video Conversion\""
       fi
      done
      

The actual script works perfectly if handtyped in Terminal but FFMPEG return "Error opening output files: Invalid argument" when run within the Automator workflow (I tried both with and without sudo/admin permissions).

For the non sudo part I removed the first two actions and removed "sudo" from the ffmpeg command.

This is the output (I added *REDACTED FOR PRIVACY* instead of actual filenames):

ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
built with Apple clang version 16.0.0 (clang-1600.0.26.4)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
libavutil 59. 39.100 / 59. 39.100
libavcodec 61. 19.100 / 61. 19.100
libavformat 61. 7.100 / 61. 7.100
libavdevice 61. 3.100 / 61. 3.100
libavfilter 10. 4.100 / 10. 4.100
libswscale 8. 3.100 / 8. 3.100
libswresample 5. 3.100 / 5. 3.100
libpostproc 58. 3.100 / 58. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '*REDACTED FOR PRIVACY*':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: isommp41mp42
creation_time : 2024-12-30T17:06:35.000000Z
Duration: 00:00:15.00, start: 0.000000, bitrate: 5122 kb/s
Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 5119 kb/s, SAR 1:1 DAR 16:9, 24 fps, 24 tbr, 24k tbn (default)
Metadata:
creation_time : 2024-12-30T17:06:35.000000Z
handler_name : Core Media Video
vendor_id : [0][0][0][0]
Trailing garbage at the end of a stream specifier: c
Error opening output file *REDACTED FOR PRIVACY*.
Error opening output files: Invalid argument”
-- Full Automator Workflow

Viewing all articles
Browse latest Browse all 118075

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>