iPhone streaming

6 views
Skip to first unread message

Butch

unread,
Nov 16, 2009, 12:55:48 PM11/16/09
to Panda
I have been able to get the following to work for iphone streaming,
but only on 3GS, not 3G or iPod Touch. I have rebuilt FFMPEG, so some
of these options may not work, or will be different, than on the
current release.

def encode_iphone
Merb.logger.info "Encoding for iPhone"
transcoder = RVideo::Transcoder.new
recipe = "ffmpeg -y -i $input_file$ -f ipod -vcodec libx264 -s
320x240 -ab 128kb -ac 2 -b 640kb -flags +loop -cmp +chroma -partitions
0 -coder 0 -me_method hex -me_range 16 -g 300 -keyint_min 25 -
sc_threshold 40 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -vpre ipod320
$output_file$"
transcoder.execute(recipe, self.recipe_options
(self.parent_video.tmp_filepath, self.tmp_filepath))
end

Anyone have a recipe that works for iPhone 3G or know what might be
wrong with this one?

chuck

unread,
Nov 16, 2009, 1:01:31 PM11/16/09
to Panda
I'm not sure about streaming since I'm using S3, but this is my iPhone
encoding profile that works with the iPod Touch, I haven't tested it
with the 3G though.

"ffmpeg -threads 4 -y -i $input_file$ -r 29.97 -vcodec libx264
$resolution_and_padding_no_cropping$ -flags +loop -cmp +chroma -
deblockalpha 0 -deblockbeta 0 -crf 24 -bt 256k -refs 1 -coder 0 -me
umh -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g
250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -trellis 2 -
sc_threshold 40 -i_qfactor 0.71 -acodec libmp3lame -ab 128k -ar 48000 -
ac 2 $output_file$"

Butch Wesley

unread,
Nov 16, 2009, 1:56:00 PM11/16/09
to panda...@googlegroups.com
Thanks I'll give that a try.  Can you post the details of your profile as well?  or at least the values that you use in the substitutions like $resolution_and_padding_no_cropping$?
--
Butch Wesley
513-304-2162
butch....@gmail.com

chuck

unread,
Nov 16, 2009, 2:05:13 PM11/16/09
to Panda
If I remember correctly, the line:
:resolution_and_padding_no_cropping =>
self.ffmpeg_resolution_and_padding_no_cropping
had to be added manually but the method already existed in the code.
If you don't see it I can post it when I get back on my AMI, just let
me know.

def recipe_options(input_file, output_file)
{
:input_file => input_file,
:output_file => output_file,
:container => self.container,
:video_codec => self.video_codec,
:video_bitrate_in_bits => self.video_bitrate_in_bits.to_s,
:fps => self.fps,
:audio_codec => self.audio_codec.to_s,
:audio_bitrate => self.audio_bitrate.to_s,
:audio_bitrate_in_bits => self.audio_bitrate_in_bits.to_s,
:audio_sample_rate => self.audio_sample_rate.to_s,
:resolution => self.resolution,
:resolution_and_padding => self.ffmpeg_resolution_and_padding,
:resolution_and_padding_no_cropping =>
self.ffmpeg_resolution_and_padding_no_cropping
}
end

def encode_iphone
Merb.logger.info "Encoding with encode_iphone"
transcoder = RVideo::Transcoder.new
recipe = "ffmpeg -threads 4 -y -i $input_file$ -r 29.97 -vcodec
libx264 $resolution_and_padding_no_cropping$ -flags +loop -cmp +chroma
-deblockalpha 0 -deblockbeta 0 -crf 24 -bt 256k -refs 1 -coder 0 -me
umh -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g
250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -trellis 2 -
sc_threshold 40 -i_qfactor 0.71 -acodec libmp3lame -ab 128k -ar 48000 -
ac 2 $output_file$"
transcoder.execute(recipe, self.recipe_options
(self.parent_video.tmp_filepath, self.tmp_filepath))
end

> butch.wes...@gmail.com

chuck

unread,
Nov 16, 2009, 2:19:45 PM11/16/09
to Panda
Just realized you meant the profile definition. This is what I get
when I do a Profile.find(id=profile_id)
"video_codec"=>"libx264", "container"=>"mp4", "player"=>"iphone",
"updated_at"=>"2009-10-14T13:53:02+00:00", "title"=>"iPhone",
"audio_codec"=>"libmp3lame",
"height"=>"00000000000000000000000000000320", "fps"=>"29.97",
"created_at"=>"2009-10-14T13:53:02+00:00",
"width"=>"00000000000000000000000000000480"},

Butch

unread,
Nov 25, 2009, 9:34:07 AM11/25/09
to Panda
Didn't want to leave this hanging. I had some issues getting your
stuff to work. Most probably stupid errors on my part. My patience
ran out and other stuff came up, so as of now I'm leaving it at 3GS
streaming and not worrying about 3G or Touch streaming. My time on
this project is almost at an end and I will be handing this off to
someone else. I'll leave them a link to this thread and ask them to
update if they find a solution, but don't hold your breath. Thanks
for your help.
> > > > > Anyone have a recipe that works foriPhone3G or know what might be
Reply all
Reply to author
Forward
0 new messages