<div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">> I use ffmpeg to convert my recording to the PSP.<br>><br>> When I attempt to run ffmpeg on an ISO image from a DVD I get:
<br>> "could not find codec parameters"</blockquote><div><br>I have all of this working now and I would like to:<br>1. Add it to the wiki, can someone suggest a location.<br>2. Improve the shell script to automate this a bit more
<br><br>If anyone has some suggestions on the shell script, shoot them at me, it will be greatly appreciated.<br><br>Some of the improvements I would like to make:<br><br><br>1. Pass in the ISO file, have the shell script automatically mount it (not sure how to do this since I think it requires sudo rights and I am not sure how to give those rights to a different user).
<br><br><br>2. Make the error checking a bit better:<br> - This works, but the files might have different names<br>if [ ! -f "$ISODIR/video_ts/vts_01_1.vob" ]; then <br>
<br> - What I really wanted to do is check if there are any VOBs<br>if [ ! -f "$ISODIR/video_ts/*.vob" ]; then <br><br></div></div><br>3. Modprobe loop<br>- sudo modprobe loop
<br>- Don't know if you have to do this everytime, or can I have the system auto load the loop module. Not knowing what it actually does, not sure if this is a good idea or not.<br><br><br>4. Reporting elapsed time.
<br>- I found this code googling around for a bit:<br>start="$(date +%s)"<br>end="$(date +%s)" <br>elapsed="$(expr $end - $start)" <br>echo Elapsed seconds for transcode: $elapsed
<br><br>But that only shows seconds, I wanted to do something like this:<br> elapsed="$(expr ($end - $start)/60)" <br> echo Elapsed minutes for transcode: $elapsed
<br>But I get expression errors.<br><br><br>In this case I wanted it transcoded for the PSP, but the end result doesn't matter. It is the mounting of the ISO and the "cat"ing of the VOBs as input to ffmpeg that was the key to doing it.
<br><br>Here is the script so far:<br>*******************<br>#!/bin/sh <br>ISODIR=$1
<br>TITLE=$2 <br>RSSDIR="/media/mythtv/rss" <br>OUTFILENAME=${RSSDIR}/${TITLE}.MP4
<br> <br>echo "pspisoencode called with: $1 $2" <br># Sanity checking, to make sure everything is in order.
<br>if [ -z "$ISODIR" -o -z "$ISODIR/video_ts" ]; then <br> echo "Usage: " <br> echo " First mount the ISO"
<br> echo " sudo mkdir /media/iso" <br> echo " sudo modprobe loop" <br> echo " sudo mount
file.iso /media/iso/ -t iso9660 -o loop" <br> echo " After mounting the appropriate ISO:" <br> echo " Usage: $0 <ISODirectory> <OutFileName>"
<br> exit 5 <br>fi <br>#if [ ! -f "$ISODIR/video_ts/*.vob" ]; then
<br># if [ ! -f "$ISODIR/video_ts/vts_01_1.vob" ]; then <br># echo "No VOBs exist: $ISODIR/video_ts" <br># exit 6
<br># fi <br> <br>echo "Beginning transcode at:$(date)"
<br>start="$(date +%s)" <br># PSP firmware > 3.20 supports a scale of 480x272 <br># Increase the volume from default of 256 to 480
<br>cat $ISODIR/video_ts/*.vob | ffmpeg -i - -y -acodec aac -ab 96 -vcodec h264 -b 280<br>>>kb -ar 48000 -mbd 2 -coder 1 -cmp 2 -subcmp 2 -s 480x272 -r 30000/1001 -f psp -f<br>>>lags loop -trellis 2 -partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -l
<br>>>evel 13 -vol 500 "${OUTFILENAME}" <br> <br>end="$(date +%s)"
<br>echo "Ended transcode at:$(date)" <br> <br>elapsed="$(expr $end - $start)"
<br>echo Elapsed seconds for transcode: $elapsed <br># elapsed="$(expr $($end - $start)/60)" <br># echo Elapsed minutes for transcode: $elapsed
<br>*******************<br><br>Hope it helps someone else.<br>Dave<br><br><br><br><br>