LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   FFmpeg Video Conversion Optimization (https://www.linuxquestions.org/questions/linux-software-2/ffmpeg-video-conversion-optimization-4175627281/)

snowman81 04-08-2018 09:28 PM

FFmpeg Video Conversion Optimization
 
So I'm writing a script that checks my downloaded files for a few different filetypes (.mkv, .avi, .mp4) and converts them into 2 channel mp4 files so that they work with my Roku. The scripting part I can handle but I have no idea what I'm doing with all the different FFmpeg options. If an MKV or AVI come in I convert to MP4 and if it's an MP4 already it checks to see if they're are only 2 channels and if not, converts it to stereo. Are my FFmpeg options ok or are there more efficient, better, less resource intensive, options?

MKV
Code:

ffmpeg -i $($OldVideo) -c:v copy -acodec libmp3lame -ab 160k -ar 48000 -async 48000 -ac 2 $($NewVideo)
AVI
Code:

ffmpeg -i $($OldVideo) -ac 2 $($NewVideo)
MP4
Code:

ffmpeg -i $($OldVideo) -ac 2 $($NewVideo)
The AVI option also adds the .MP4 extension at the end.

BW-userx 04-08-2018 09:59 PM

the setting are whatever you needs, I do not see any resource intensive options being used.

then the better question is
define resource intensive

I'd think that you'd give into whatever it takes to get a re sample file to the quality you want it to be. With the understanding you cannot increase quality, only reduce quality from the base it started at.

what are you running under the hood?

snowman81 04-09-2018 09:16 AM

8 core AMD FX and 16 Gigs of ram. I'm trying to get everything to mp4's just for standardization purposes and it needs to be able to play on my roku/tv which only has the tv speakers.

BW-userx 04-09-2018 09:26 AM

Quote:

Originally Posted by snowman81 (Post 5841056)
8 core AMD FX and 16 Gigs of ram. I'm trying to get everything to mp4's just for standardization purposes and it needs to be able to play on my roku/tv which only has the tv speakers.

that's understandable, but I do not think you're going to have much of a performance hit wtih 8 cores and 16GB's of RAM. that's what I am running. but its Intel. (not that brand matters much).

due to you, I've actually went back and looked up how to for Handbrake to resample my movies and resize them so get them smaller in screen size as well as MB/GB size. Using the command line, whereas HandBreak use to have an iuuse with not being able to loop through files. It'd get stuck after the first one, now I've found that is no longer an issue.

at full screen the picture is not that degraded for my laptop usage.

let me give you what I worked out you might want to see if that will give you the desired results as HandBreak is curtailed to resampling movies. to give you more options for your endeavor.

At the moment it is currently in the testing phase right now so I am still waiting for a move to finish so I can view the results.

My script is still in the makings and as you should know more custom options can be added.
Code:

#!/bin/bash

#
# Change this to specify a different handbrake preset. You can list them by running: "HandBrakeCLI --preset-list"
#

SRC="/media/data/HBtestFiles"
DEST="/media/data/HB.Test.Files"
keep_old=/media/data/old_movies
DEST_EXT=mp4
HANDBRAKE_CLI=HandBrakeCLI
PRESET="Fast 480p30"

for F in "$SRC"/*
do
    filename=$(basename "$F")
    path=${F%*/}
    echo "$path"
    echo
    extension=${filename##*.}
    filename=${filename%.*}
    send_to="$DEST"/"$filename"."$DEST_EXT"
   
  $HANDBRAKE_CLI --preset="$PRESET" -i "$F" -o "$send_to"
 
  #if blank it does not move old out of directory.
  [[ -n "$keep_old" ]] && (mkdir -p "$keep_old" ; mv "$F" "$keep_old")
 
done

as far as your ffmpeg looks good to me.

I found this script for HandBrake for roku/tv.
Might be worth looking at.

https://gist.github.com/donmelton/5734177

snowman81 04-09-2018 01:44 PM

I'll check it out. Thanks!


All times are GMT -5. The time now is 06:14 PM.