LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-08-2018, 10:28 PM   #1
snowman81
Member
 
Registered: Aug 2006
Location: Michigan
Distribution: Ubuntu
Posts: 281

Rep: Reputation: 30
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.

Last edited by snowman81; 04-08-2018 at 10:30 PM. Reason: More info
 
Old 04-08-2018, 10:59 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149
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?

Last edited by BW-userx; 04-08-2018 at 11:34 PM.
 
Old 04-09-2018, 10:16 AM   #3
snowman81
Member
 
Registered: Aug 2006
Location: Michigan
Distribution: Ubuntu
Posts: 281

Original Poster
Rep: Reputation: 30
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.
 
Old 04-09-2018, 10:26 AM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149
Quote:
Originally Posted by snowman81 View Post
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

Last edited by BW-userx; 04-09-2018 at 11:27 AM.
 
Old 04-09-2018, 02:44 PM   #5
snowman81
Member
 
Registered: Aug 2006
Location: Michigan
Distribution: Ubuntu
Posts: 281

Original Poster
Rep: Reputation: 30
I'll check it out. Thanks!
 
  


Reply

Tags
ffmpeg; video


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ffmpeg : mp4 conversion - no video in output file DBabo Linux - Software 2 02-28-2017 04:06 PM
FFMPEG Mass Conversion Question Bonken Linux - Newbie 13 08-05-2009 09:35 AM
ffmpeg ogg to flv conversion inquisitiveme Linux - Newbie 1 03-10-2009 03:52 PM
Green screen after video conversion, AVI to MP4 using Mencoder,Mplayer,FFmpeg,x264, manuken Linux - Newbie 4 10-29-2008 07:40 PM
need ffmpeg mp3 conversion help yajur Programming 18 07-20-2008 06:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration