[FFmpeg-user] Convert some hundreds files to a H264

Tom Sparks tom_a_sparks at yahoo.com.au
Wed May 18 03:23:06 CEST 2011


--- On Tue, 17/5/11, belcampo <belcampo at zonnet.nl> wrote:

> From: belcampo <belcampo at zonnet.nl>
> Subject: Re: [FFmpeg-user] Convert some hundreds files to a H264
> To: "FFmpeg user questions and RTFMs" <ffmpeg-user at ffmpeg.org>
> Received: Tuesday, 17 May, 2011, 8:18 PM
> On 05/17/11 11:16, marcos rebelo
> wrote:
> > My problem is to do the [insert your commands here],
> >
> > In my opinion, it should be easy to give some commands
> defining the
> > final format of the video and ignore the original
> format, a smart
> > script should analyse the video and it should create
> the [insert your
> > commands here].
> >
> > Note that my files are correctly visible on mplayer.
> If mplayer detects/analyses your files correct, so will
> ffmpeg, compiled 
> with the same codecs, do the same. Nothing special to do
> AFAIK.
> >
> > Thanks for all help
> >
> >
this code may give you a starting place, it was brrowed from http://www.mythtv.org/wiki/Stream_mythtv_recordings_from_mythweb_using_flash_video

#!/bin/bash

directory=$1;
file=$2;

# Determine aspect ratio
original_name=$1/$2;

#Grab input file information
videoheight=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_HEIGHT" | sed -e 's/ID_VIDEO_HEIGHT=//'`

height=240;
if [ "$videoheight" -gt 480 ]; then
   # "HDTV"
   width=426
else
   # "SDTV"
   width=320
fi

dimensions=$width"x"$height;

# Create the flash video (flv) file with a frame rate of 20fps
# deinterlace the video and set an apropriate audio sample rate
ffmpeg -y -i $directory/$file -r 20 -s $dimensions -deinterlace -ar 22050 $directory/$file.flv 1>/dev/null 2>/dev/null

# Add metadata to file file (optional)
cat $directory/$file.flv | flvtool2 -U stdin $directory/$file.flv


tom


More information about the ffmpeg-user mailing list