BlackBerryForums.com : Your Number One BlackBerry Community
     

»Sponsored Links


BlackBerryApps.com Best Sellers



Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default vid2bb.sh: using mencoder to create videos - 02-19-2007, 01:51 PM

Originally posted in the 8100 forum in the encoding thread; this is a little script I wrote based on the parameters they've worked out. It's worked great for me.

== snip ==

Getting the right params to mencoder to produce top quality video is always a chore, but using method 1 in the original post is working wonderfully for me -- I've converted all sorts of stuff (WMV/AVI/MPG/FLV/MOV) and so far only the FLV conversions have audio sync problems (nothing new). I'm even going to say that the videos look better (and run smoother!) on my Pearl than any S60 device I've used.

Stupid Bash Trick time -- here's a helper script, save it as "vid2bb.sh" somewhere in your $PATH on Linux/OSX. Make it executable then run with a simple "vid2bb.sh <FILE>" command, the output will be in the input directory.

Code:
#!/bin/bash

FILE=$1

## 8100, 240x260 res
## uncomment one of the below depending on your input format
#RES=240:135             # resolution, 16:9 ratio
RES=240:180             # resolution, 4:3 ratio

## 8800, 320x240 res
## uncomment one of the below depending on your input format
#RES=320:180             # resolution, 16:9 ratio
#RES=240:180             # resolution, 4:3 ratio

## generic
ABR=64                  # audio bitrate
VBR=230                 # video bitrate

mencoder "$FILE" \
        -o "${FILE%.*}_bb.avi" \
        -of avi \
        -ovc lavc \
        -oac lavc \
        -lavcopts vcodec=mpeg4:vbitrate=$VBR:acodec=mp3:abitrate=$ABR \
        -vf scale=$RES
Note that the above takes the input filename, chops off the extension and adds a "_bb.avi" to the end of the output file to help you know which files are your BB ready ones. A quick sort, drag&drop and they're on your device.

My setup is Fedora Core 6 with the FreshRPMS mplayer builds installed (which grabs all the latest libavcodec and so on), as well as the Essential codecs pack (from the MPlayer website) unxipped to /usr/lib/win32/ -- these codecs always seem to produce better quality.

Last edited by rivviepop : 03-31-2007 at 12:22 AM.
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
LunkHead Offline
BlackBerry Mensa
 
LunkHead's Avatar
 
Posts: 9,634
Join Date: Jan 2005
Location: Prison
Model: 850
OS: 0.0.00001
PIN: How do I find mine?
Carrier: Post Office
Default 02-23-2007, 06:33 PM

And one last sticky request please


"A journey of a thousand miles begins with a single step."

   
Reply With Quote
  (#3 (permalink)) Old
indramilo Offline
Thumbs Must Hurt
 
Posts: 70
Join Date: Dec 2006
Location: Cd. Juárez, Chihuahua, México
Model: 8100
PIN: 2053A30B
Carrier: Telcel
Default 02-25-2007, 11:07 AM

man... I love Linux Philosophy

and thanks for the code rivviepop :D


[Blackberry & Linux]
Blackberry 8100
   
Reply With Quote
  (#4 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 02-25-2007, 03:56 PM

Quote:
Originally Posted by indramilo
and thanks for the code rivviepop :D
my pleasure! I'll tell you a little secret - I own [ bash-fu ] My professional life over the years as a systems engineer has given me ample opportunity to become one with the bourne. I thank my workplace and boss (who rocks) for allowing me to get nerdy on company time.
   
Reply With Quote
  (#5 (permalink)) Old
LunkHead Offline
BlackBerry Mensa
 
LunkHead's Avatar
 
Posts: 9,634
Join Date: Jan 2005
Location: Prison
Model: 850
OS: 0.0.00001
PIN: How do I find mine?
Carrier: Post Office
Default 02-28-2007, 09:48 PM

Well, no doubt you are the man rivvie... Love the info on you're site... It ROCKS!


"A journey of a thousand miles begins with a single step."

   
Reply With Quote
  (#6 (permalink)) Old
erroneus Offline
Knows Where the Search Button Is
 
erroneus's Avatar
 
Posts: 42
Join Date: Feb 2007
Location: Texas
Model: 8100
Carrier: T-Mobile
Default 03-02-2007, 10:05 AM

Yes, I have used this scriptlet many times. Here's a problem though... and I hope it can be addressed quickly (as in today) because I'll be flying to Japan tomorrow and will be there for two weeks. I'd like to watch a couple of full-length movies on my BB8100!

Here's the problem. I encoded two movies down to BB size but these are formatted for wide-screen display. What do I need to change to make it look right on my BB display? Right now, they come out squished up horizontally.

Okay... right now, I'm re-coding it... don't have the original files available to me at the moment... hope the quality stays good. I set the target aspect ratio to be wider... I have no idea how the BB will play it though...

Okay, I recoded two movies. I just set the RES from 240:180 to 240:120 and it looks much better now... no notable decrease in size and so no decrease in quality is expected.... looks pretty good so far. I can still read the subtitles so I'm good.


Device: Blackberry 8100 v4.2.0.64
Carrier: T-Mobile USA
BES: 4.1.0.38
Desktop OS: Fedora 7 Linux, Windows XP (vmware)

Last edited by erroneus : 03-02-2007 at 02:06 PM.
   
Reply With Quote
  (#7 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 03-02-2007, 01:26 PM

Quote:
Originally Posted by erroneus
because I'll be flying to Japan tomorrow
*jealous* Can I come? I'm super harajuku friendly.

Quote:
Here's the problem. I encoded two movies down to BB size but these are formatted for wide-screen display. What do I need to change to make it look right on my BB display? Right now, they come out squished up horizontally.
Ugh, never a fun problem; this is the dreaded 16:9 <=> 4:3 conversion problem (if I read/understand your post correctly). Help me out here -- are you saying the original movie is in 4:3 format and it's coming out 16:9, or the other way around? No, wait... ok this line:

RES=240:180

...is a 4:3 ratio. So, it sounds like you have a 16:9 movie -- what you want to do is adjust that ratio set to be 16:9, so maybe:

RES=240:135

...which is a 16:9 ratio exactly (well, exact as my little TI calculator can do ). I bet that'll get rid of your squishedness.
   
Reply With Quote
  (#8 (permalink)) Old
erroneus Offline
Knows Where the Search Button Is
 
erroneus's Avatar
 
Posts: 42
Join Date: Feb 2007
Location: Texas
Model: 8100
Carrier: T-Mobile
Default 03-02-2007, 02:07 PM

Yeah, I decided to actually read the script and the answer seemed obvious. I didn't use a calculator like you did, so I didn't come up with a figure as exact. The proportions look good enough though.


Device: Blackberry 8100 v4.2.0.64
Carrier: T-Mobile USA
BES: 4.1.0.38
Desktop OS: Fedora 7 Linux, Windows XP (vmware)
   
Reply With Quote
  (#9 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 03-02-2007, 03:26 PM

Quote:
Originally Posted by erroneus
Yeah, I decided to actually read the script and the answer seemed obvious. I didn't use a calculator like you did, so I didn't come up with a figure as exact. The proportions look good enough though.
Cool cool, I just updated the scriptlet to clarify that, so maybe it'll help the next person who comes along.
   
Reply With Quote
  (#10 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 03-03-2007, 02:33 PM

I just added hopefully the correct res sizes for the 8800 (320x240) devices, I'm about to go troll the 8800 forum for a guinea pig. If you have an 8800 try it out and report back.
   
Reply With Quote
  (#11 (permalink)) Old
erroneus Offline
Knows Where the Search Button Is
 
erroneus's Avatar
 
Posts: 42
Join Date: Feb 2007
Location: Texas
Model: 8100
Carrier: T-Mobile
Default 03-04-2007, 04:37 PM

I wonder if there's a way to add a command-line or two to determine the aspect ratio of the source video and simply either make a selection of aspect ratios or calculate the new, scaled down size for the target video file?

Well, I'm in Japan now and watching videos on the phone during the flight was pretty cool! Here's some tips! Disable the radio and bluetooth for impressive battery life. They want you to turn those things off during flight anyway, but there's a pretty good reason to comply right there. On the flight back, I'm going to re-code as many episodes of "Scrubs" as I can to fit on my 1GB mem card. (I wanted to get a 2GB card, but the price point wasn't attractive enough... the ratios are out of whack but then again, I saw a deal online recently where a 1GB card was like $15 or something like that...ridiculously cheap while 2GB remains at about $50....)

Yes, the 8800 being released within a day or two after I bought my 8100 gave me reason to pause. But then again, I might have gone with the 8100 anyway. The size is perfect. Going bigger doesn't appeal to me much at all.


Device: Blackberry 8100 v4.2.0.64
Carrier: T-Mobile USA
BES: 4.1.0.38
Desktop OS: Fedora 7 Linux, Windows XP (vmware)
   
Reply With Quote
  (#12 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 03-04-2007, 08:31 PM

Quote:
Originally Posted by erroneus
I wonder if there's a way to add a command-line or two to determine the aspect ratio of the source video and simply either make a selection of aspect ratios or calculate the new, scaled down size for the target video file?
Yeah, it's on my list of things to do. If nothing else I want a commandline switch to choose a res, but it just hasn't been the highest priority item on my list of stuff. Maybe some day...but not today.
   
Reply With Quote
  (#13 (permalink)) Old
tuxi Offline
New Member
 
Posts: 7
Join Date: Mar 2007
Location: Katy, TX
Model: 8800
Carrier: AT&T
Default 03-25-2007, 07:59 PM

I'm an 8800 user and will be happy to help with getting this script to work for me. I've been a Linux user for six years and am presently using Fedora Core 6 and Ubuntu 6.10. My BlackBerry is generally used with my company laptop, which has Windows XP.

When I've tried the script, I've had the video only show a couple of frames. I've tried with multiple mp4 formats as the source. All videos were rendered using Kino from personal DV files.
   
Reply With Quote
  (#14 (permalink)) Old
LunkHead Offline
BlackBerry Mensa
 
LunkHead's Avatar
 
Posts: 9,634
Join Date: Jan 2005
Location: Prison
Model: 850
OS: 0.0.00001
PIN: How do I find mine?
Carrier: Post Office
Default 03-25-2007, 08:01 PM

Sweet! AND Welcome to the forums!!!!!!


"A journey of a thousand miles begins with a single step."

   
Reply With Quote
  (#15 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 03-25-2007, 08:14 PM

Quote:
Originally Posted by tuxi
When I've tried the script, I've had the video only show a couple of frames. I've tried with multiple mp4 formats as the source. All videos were rendered using Kino from personal DV files.
This smells like poor encoding/decoding libs (I can't say for sure, but it's the first thing that comes to mind based on experience). Do you:

- have a newer mplayer installed from FreshRPMS? (or maybe RF or ATrpms)
linky: http://zod.freshrpms.net/rpm.html?id=888

- have the "win32" DLL files unzipped to /usr/lib/win32/ on your machine?
linky: http://www.mplayerhq.hu/design7/dload.html
direct x86 snag: http://www3.mplayerhq.hu/MPlayer/rel...061022.tar.bz2

As we all know, video encoding/decoding w/linux can be sort of hit or miss depending on your source; on my laptop I have the above two in place which does't produce any bad videos (most of the time, of course there are exceptions) and actually they're quite good.

Feel free to upload a smaller mp4 (if legal) that's giving you trouble and I'll give it a whirl, see what happens on my end.
   
Reply With Quote
  (#16 (permalink)) Old
LunkHead Offline
BlackBerry Mensa
 
LunkHead's Avatar
 
Posts: 9,634
Join Date: Jan 2005
Location: Prison
Model: 850
OS: 0.0.00001
PIN: How do I find mine?
Carrier: Post Office
Default 03-25-2007, 08:16 PM

My vids are ALL horrid!

@rivviepop don't you owe me a beer???? lol


"A journey of a thousand miles begins with a single step."

   
Reply With Quote
  (#17 (permalink)) Old
tuxi Offline
New Member
 
Posts: 7
Join Date: Mar 2007
Location: Katy, TX
Model: 8800
Carrier: AT&T
Default 03-26-2007, 10:51 PM

Quote:
Originally Posted by rivviepop
This smells like poor encoding/decoding libs (I can't say for sure, but it's the first thing that comes to mind based on experience). Do you:

- have a newer mplayer installed from FreshRPMS? (or maybe RF or ATrpms)

- have the "win32" DLL files unzipped to /usr/lib/win32/ on your machine?
linky:
direct x86 snag:
I checked to see if my machine was setup as you describe before I ran the script.
rpm -qi mencoder gives
Code:
Name        : mencoder                     Relocations: (not relocatable)
Version     : 1.0                               Vendor: Freshrpms.net
Release     : 0.34.rc1try2.fc6              Build Date: Tue 09 Jan 2007 04:22:36 AM CST
Install Date: Sat 10 Feb 2007 07:50:47 AM CST      Build Host: python3.freshrpms.net
Group       : Applications/Multimedia       Source RPM: mplayer-1.0-0.34.rc1try2.fc6.src.rpm
Size        : 7362484                          License: GPL
Signature   : DSA/SHA1, Tue 09 Jan 2007 04:23:30 AM CST, Key ID 692ac459e42d547b
Packager    : Matthias Saou <matthias@rpmforge.net>
URL         : --
Summary     : MPlayer’s Movie Encoder
Description :
MPlayer’s Movie Encoder is a simple movie encoder, designed to encode
MPlayer-playable movies to other MPlayer-playable formats. It encodes to
MPEG-4 (DivX/XviD), one of the libavcodec codecs and PCM/MP3/VBRMP3 audio
in 1, 2 or 3 passes.  Furthermore  it has stream copying abilities, a
powerful filter system (crop, expand, flip, postprocess, rotate, scale,
noise, rgb/yuv conversion) and more.
I'll PM you with a URL to pick up the example video.


Tuxi
BlackBerry 8800
AT&T
BES (version unknown)
Windows XP, Ubuntu 8.10
   
Reply With Quote
  (#18 (permalink)) Old
LunkHead Offline
BlackBerry Mensa
 
LunkHead's Avatar
 
Posts: 9,634
Join Date: Jan 2005
Location: Prison
Model: 850
OS: 0.0.00001
PIN: How do I find mine?
Carrier: Post Office
Default 03-26-2007, 11:26 PM

Looks OK to me but I will await rivviepop's response since he is far more advanced than me....

Quote:
Originally Posted by tuxi
I checked to see if my machine was setup as you describe before I ran the script.
rpm -qi mencoder gives
Code:
Name        : mencoder                     Relocations: (not relocatable)
Version     : 1.0                               Vendor: Freshrpms.net
Release     : 0.34.rc1try2.fc6              Build Date: Tue 09 Jan 2007 04:22:36 AM CST
Install Date: Sat 10 Feb 2007 07:50:47 AM CST      Build Host: python3.freshrpms.net
Group       : Applications/Multimedia       Source RPM: mplayer-1.0-0.34.rc1try2.fc6.src.rpm
Size        : 7362484                          License: GPL
Signature   : DSA/SHA1, Tue 09 Jan 2007 04:23:30 AM CST, Key ID 692ac459e42d547b
Packager    : Matthias Saou <matthias@rpmforge.net>
URL         : --
Summary     : MPlayer’s Movie Encoder
Description :
MPlayer’s Movie Encoder is a simple movie encoder, designed to encode
MPlayer-playable movies to other MPlayer-playable formats. It encodes to
MPEG-4 (DivX/XviD), one of the libavcodec codecs and PCM/MP3/VBRMP3 audio
in 1, 2 or 3 passes.  Furthermore  it has stream copying abilities, a
powerful filter system (crop, expand, flip, postprocess, rotate, scale,
noise, rgb/yuv conversion) and more.
I'll PM you with a URL to pick up the example video.


"A journey of a thousand miles begins with a single step."

   
Reply With Quote
  (#19 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 03-26-2007, 11:32 PM

Quote:
Originally Posted by tuxi
I'll PM you with a URL to pick up the example video.
OK, I have the video here, mplayer tells me it's a 4:3 and it's playing just fine on my laptop. I converted it to both a 240x180 and 320x240 (which are both 1.33:1 ratio, 4:3) and they both play perfectly fine on my Pearl without any issues. I'll PM you back a link in a sec after I upload them somewhere.

You had asked about what the right size is in PM -- well, the *specs* say an 8800 is supposed to be able to play 320x240 (which would be fullscreen) but I don't have one to test with over my way, so I am unsure. But the 240x180 version should probably play fine on your device, I would imagine it might have a black border on the left and right though? (you'll have to tell me)

Regardless, let us know how these vids I converted work on your 8800...
   
Reply With Quote
  (#20 (permalink)) Old
tuxi Offline
New Member
 
Posts: 7
Join Date: Mar 2007
Location: Katy, TX
Model: 8800
Carrier: AT&T
Default 03-27-2007, 07:56 AM

Quote:
Originally Posted by rivviepop
<snip>
You had asked about what the right size is in PM -- well, the *specs* say an 8800 is supposed to be able to play 320x240 (which would be fullscreen) but I don't have one to test with over my way, so I am unsure. But the 240x180 version should probably play fine on your device, I would imagine it might have a black border on the left and right though? (you'll have to tell me)

Regardless, let us know how these vids I converted work on your 8800...
Both of your videos performed better than my attempts at 320x240. I had already prepared a 240x180 prior to getting the link, so I also tested it. Both your and my 240x180 videos played with no hesitation. Your 320x240 version hesitated at the beginning, but it started playing OK after 30-60 frames.

All of the 4:3 videos play with black bars on the side since the display on the 8800 is apparently 16:9. I stick with my assertion that if 320 pixels is the width, then 180 must be the height. If this is correct, the proper 4:3 size is 240x180, and the player has to reduce the video size on the fly if it is in a higher resolution.

A question on the win32 codecs:
I copied the newest codecs into /usr/lib/win32. Some of the older codecs (with slightly different names) remain in the directory. Should I purge the directory and recopy the newest only? Thanks.


Tuxi
BlackBerry 8800
AT&T
BES (version unknown)
Windows XP, Ubuntu 8.10
   
Reply With Quote
  (#21 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 03-27-2007, 02:37 PM

Quote:
Originally Posted by tuxi
A question on the win32 codecs:
I copied the newest codecs into /usr/lib/win32. Some of the older codecs (with slightly different names) remain in the directory. Should I purge the directory and recopy the newest only? Thanks.
I always whack the entire thing and just unzip/rename the latest one when I do it, I don't try overwriting or any such mojo. Try that instead maybe? I don't think anything except mplayer/mencoder uses that directory so it's probably pretty safe.
   
Reply With Quote
  (#22 (permalink)) Old
tuxi Offline
New Member
 
Posts: 7
Join Date: Mar 2007
Location: Katy, TX
Model: 8800
Carrier: AT&T
Default 03-30-2007, 06:25 PM

After further thinking, it appears that the 8800's screen is 320x240 (whole screen, hence sort of true and OK for marketing). Sixty total pixels appear to be used for borders/controls at top and bottom in the media player. This leaves 180 pixels vertically for videos. On these assumptions, the correct sizes for 8800 videos are 16:9 - 320x180 and 4:3 - 240x180.


Tuxi
BlackBerry 8800
AT&T
BES (version unknown)
Windows XP, Ubuntu 8.10
   
Reply With Quote
  (#23 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 03-31-2007, 12:24 AM

Quote:
Originally Posted by tuxi
On these assumptions, the correct sizes for 8800 videos are 16:9 - 320x180 and 4:3 - 240x180.
I'm with ya - I just updated the scriptlet to list those rez; even though the 4:3 is the same for both, I left it called out in each section so there's no confusion.

BTW: this video converts superbly.

http://www.sadkermit.com/
   
Reply With Quote
  (#24 (permalink)) Old
yigalweinstein Offline
Knows Where the Search Button Is
 
Posts: 16
Join Date: Jun 2007
Model: 8100
PIN: N/A
Carrier: t-mobile
Default 06-06-2007, 04:41 PM

this script is really quite nice. Thank you now I can watch what ever I want to on my 8100 although with its micro sized screen I am not so impelled - but I CAN if I want or need to, so thank you.
   
Reply With Quote
  (#25 (permalink)) Old
NinjitsuStylee Offline
New Member
 
Posts: 7
Join Date: Jun 2006
Location: Chicago
Model: 8100
Carrier: Tmobile
Angry Segmentation Fault? - 06-14-2007, 02:53 PM

Does anybody know what's going on here?

Every time I try to encode a video I get a segmentation fault.

Here's the output:

MEncoder 1.0pre8-4.0.3 (C) 2000-2006 MPlayer Team
CPU: AMD Athlon(tm) XP 2200+ (Family: 6, Model: 8, Stepping: 0)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled with runtime CPU detection.
success: format: 0 data: 0x0 - 0x15cc1800
AVI file format detected.
VIDEO: [XVID] 624x352 12bpp 23.976 fps 999.3 kbps (122.0 kbyte/s)
[V] filefmt:3 fourcc:0x44495658 size:624x352 fps:23.98 ftime:=0.0417
================================================== ========================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
================================================== ========================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [scale w=240 h=135]
================================================== ========================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
================================================== ========================
VDec: vo config request - 624 x 352 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.77:1 - prescaling to correct movie aspect.

SwScaler: BICUBIC scaler, from Planar YV12 to Planar YV12 using MMX2
videocodec: libavcodec (240x136 fourcc=34504d46 [FMP4])
Writing header...3f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.008 [0:0]
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Pos: 0.9s 22f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.086 [0:63]
Skipping frame!
Pos: 3.0s 73f ( 0%) 53.64fps Trem: 12min 76mb A-V:0.084 [316:64]
Skipping frame!
./vid2bb.sh: line 25: 19491 Segmentation fault mencoder "$FILE" -o "${FILE%.*}_bb.avi" -of avi -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:vbitrate=$VBR:acodec=mp3:abitrate=$AB R -vf scale=$RES




I'd really love to use this script, as it seems like the most simple solution to encoding files for the BB. I use an 8100 (Pearl) and I'm trying to do a 16:9 video.
   
Reply With Quote
  (#26 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 06-14-2007, 06:23 PM

You can use 'strace' and the direct commandline to help figure out where the problem might be. Run this:

Code:
strace mencoder (myvideo.avi) -o test_bb.avi" -of avi -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:vbitrate=230:acodec=mp3:abitrate=64 -vf scale=240:135
Replace (myvideo.avi) with your actual video, of course.

There will be gobs and gobs of output, but somewhere towards the end and the SIGSEGV (seg fault) should be something that looks interesting; it could be trying to open a file/directory and getting denied, calling a function that's getting an unexpected result, who knows. It'll be the first clue, though - what is making mencoder barf on your system?
   
Reply With Quote
  (#27 (permalink)) Old
NinjitsuStylee Offline
New Member
 
Posts: 7
Join Date: Jun 2006
Location: Chicago
Model: 8100
Carrier: Tmobile
Default results of strace - 06-14-2007, 07:03 PM

Hm... I gave strace a try, and I'm not sure if this is gonna help, here's the output:

Code:
(a bunch of mumbo jumbo........)

write(4, "01wb\300\0\0\0\377\373Td\345\200\361\317\35a\350c\32\\"..., 1318) = 1318
) = 741, "Pos: 757.8s  18173f (30%) 45.15f"..., 74Pos: 757.8s  18173f (30%) 45.15fps Trem:  15min  87mb  A-V:0.035 [222:64]
gettimeofday({1181861926, 500593}, NULL) = 0
read(3, "\325\337\253\21g\26\324\25.\216Qej\373\31\tZ\232\224u\274"..., 2048) = 2048
gettimeofday({1181861926, 503552}, NULL) = 0
gettimeofday({1181861926, 503630}, NULL) = 0
gettimeofday({1181861926, 503657}, NULL) = 0
gettimeofday({1181861926, 507858}, NULL) = 0
gettimeofday({1181861926, 509571}, NULL) = 0
gettimeofday({1181861926, 509612}, NULL) = 0
gettimeofday({1181861926, 509639}, NULL) = 0
write(4, "01wb\300\0\0\0\377\373Td\342\0001\2641\335hc\32\340\26"..., 1116) = 1116
) = 741, "Pos: 757.8s  18174f (30%) 45.15f"..., 74Pos: 757.8s  18174f (30%) 45.15fps Trem:  15min  87mb  A-V:0.035 [222:64]
gettimeofday({1181861926, 510060}, NULL) = 0
gettimeofday({1181861926, 512664}, NULL) = 0
gettimeofday({1181861926, 512712}, NULL) = 0
gettimeofday({1181861926, 515877}, NULL) = 0
read(3, "\3206\224k\321~\237\355\353^\222\323\322\322\2655E\265"..., 2048) = 2048
read(3, "\5\232\277S\255\210\325c\234\342i\27\270\234\373\24\207"..., 2048) = 2048
read(3, "\275[\307\301\340?{\360<\7\370`\312\226V\17\223\0H\7\217"..., 2048) = 2048
gettimeofday({1181861926, 516127}, NULL) = 0
gettimeofday({1181861926, 516153}, NULL) = 0
gettimeofday({1181861926, 520664}, NULL) = 0
gettimeofday({1181861926, 522409}, NULL) = 0
gettimeofday({1181861926, 522452}, NULL) = 0
gettimeofday({1181861926, 522479}, NULL) = 0
write(4, "01wb\300\0\0\0\377\373Td\345\0001\2211`\341\1\22\354\25"..., 1428) = 1428
) = 741, "Pos: 757.9s  18175f (30%) 45.15f"..., 74Pos: 757.9s  18175f (30%) 45.15fps Trem:  15min  87mb  A-V:0.035 [222:64]
gettimeofday({1181861926, 522847}, NULL) = 0
gettimeofday({1181861926, 525784}, NULL) = 0
gettimeofday({1181861926, 525836}, NULL) = 0
gettimeofday({1181861926, 529201}, NULL) = 0
read(3, "\350\221\365\223kfk\246\213\243h\252\304\322tY\250c\321"..., 2048) = 2048
gettimeofday({1181861926, 566902}, NULL) = 0
gettimeofday({1181861926, 567088}, NULL) = 0
gettimeofday({1181861926, 571192}, NULL) = 0
gettimeofday({1181861926, 572886}, NULL) = 0
gettimeofday({1181861926, 572929}, NULL) = 0
gettimeofday({1181861926, 572956}, NULL) = 0
write(4, "01wb\300\0\0\0\377\373Td\342\2011\2532^\340b\32\354\26"..., 1376) = 1376
) = 741, "Pos: 757.9s  18176f (30%) 45.15f"..., 74Pos: 757.9s  18176f (30%) 45.15fps Trem:  15min  87mb  A-V:0.036 [222:64]
gettimeofday({1181861926, 573320}, NULL) = 0
gettimeofday({1181861926, 576081}, NULL) = 0
gettimeofday({1181861926, 576167}, NULL) = 0
gettimeofday({1181861926, 576194}, NULL) = 0
gettimeofday({1181861926, 580305}, NULL) = 0
gettimeofday({1181861926, 582086}, NULL) = 0
gettimeofday({1181861926, 582135}, NULL) = 0
gettimeofday({1181861926, 582163}, NULL) = 0
write(4, "01wb\300\0\0\0\377\373Td\346\214\342\f.\325\223\6\32`\26"..., 1170) = 1170
) = 741, "Pos: 758.0s  18177f (30%) 45.15f"..., 74Pos: 758.0s  18177f (30%) 45.15fps Trem:  15min  87mb  A-V:0.035 [222:64]
gettimeofday({1181861926, 582589}, NULL) = 0
read(3, "E\343\264\32\275\344\202DI\320\305\0023N2\331\370\274\256"..., 2048) = 2048
gettimeofday({1181861926, 586108}, NULL) = 0
gettimeofday({1181861926, 586163}, NULL) = 0
gettimeofday({1181861926, 588933}, NULL) = 0
read(3, "\233|`\235\374a\223.O\247\276x3{8f\31\261\231}\234\363"..., 2048) = 2048
read(3, "i\20\371H`\323\16\357ET\214gu\253\336U\314[\32\377\221"..., 2048) = 2048
gettimeofday({1181861926, 589145}, NULL) = 0
gettimeofday({1181861926, 589171}, NULL) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

I should mention that the segmentation fault happens arbitrarily in the middle of encoding, not necessarily at the beginning. This particular file died at 30% completion. Earlier it died at 7%, and even before at around 25%. It's pretty much random.


Any suggestions?
   
Reply With Quote
  (#28 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 06-14-2007, 07:20 PM

Quote:
Originally Posted by NinjitsuStylee View Post
I should mention that the segmentation fault happens arbitrarily in the middle of encoding, not necessarily at the beginning. This particular file died at 30% completion. Earlier it died at 7%, and even before at around 25%. It's pretty much random.
Hmmm, that smells like the file has "something" (whatever it may be) in the encoding that is tripping up mencoder. Since you indicate it's at random places and with different files (at least, that's what I gather) then maybe it's in one of the binaries used? (DLL, libavcodec, etc.) I notice you're also on an older mencoder, it's possible it's a bug that's been fixed -- my FC6 system here shows 1.0rc1-4.1.1.

Feel free to PM me a link to download a (small) sample video that's crashing on you and I'll run it through my stuff, see what happens. This would at least tell us if it's something in your rig that isn't being friendly...
   
Reply With Quote
  (#29 (permalink)) Old
NinjitsuStylee Offline
New Member
 
Posts: 7
Join Date: Jun 2006
Location: Chicago
Model: 8100
Carrier: Tmobile
Default 06-14-2007, 07:36 PM

Actually, I just recently upgraded to MEncoder 1.0rc1-4.0.3 and also downloaded the most recent DLL stuff from the mplayer website, and I'm still having the same issues. Not sure how you got a more recent version...are you using one from SVN?

I'm on an Ubuntu Dapper system, btw. Not really sure if that makes a huge difference or not.

I haven't actually tried encoding a "small" video yet, I've mostly been attempting on hour-long TV shows (well 45 minutes without commercials).

Yea, it does seem like there's something in the video file that makes it hiccup. I've come to realize that it's not actually random places in the file, it's almost always the same place (for this particular file I'm doing, 30%-ish).

I'm going to try tinkering around with a few more things here, and if not I'll PM you some more info.

Thanks for all your help, btw
   
Reply With Quote
  (#30 (permalink)) Old
NinjitsuStylee Offline
New Member
 
Posts: 7
Join Date: Jun 2006
Location: Chicago
Model: 8100
Carrier: Tmobile
Default 06-14-2007, 07:40 PM

Another update....I came back into the room before it segfaulted (what, it takes forever, I'm impatient >.<) and I noticed that it actually gets to about 43% before it segfaults. But look at this:

Code:
Pos:   0.9s     22f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.086 [0:63]
Skipping frame!
Pos:   3.0s     73f ( 0%) 52.11fps Trem:  12min  76mb  A-V:0.084 [316:64]
Skipping frame!
Pos: 729.0s  17482f (29%) 50.09fps Trem:  14min  86mb  A-V:0.083 [223:63]
Skipping frame!
./vid2bb.sh: line 26: 21227 Segmentation fault      sudo mencoder "$FILE" -ffourcc XVID -o "${FILE%.*}_bb.avi" -of avi -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:vbitrate=$VBR:acodec=mp3:abitrate=$ABR -vf scale=$RES
Why would it revert back to 29% like that? Very strange...
   
Reply With Quote
  (#31 (permalink)) Old
NinjitsuStylee Offline
New Member
 
Posts: 7
Join Date: Jun 2006
Location: Chicago
Model: 8100
Carrier: Tmobile
Default 06-14-2007, 08:01 PM

I managed to successfully encode a 1.7mb avi file and a 56.1mb avi file.

The one i'm having the segfaults with is a 348.8mb Xvid (the others were divx). Another file I had segfaults with is a 347.4mb Xvid file (both are HD quality 16:9 45-ish minute recordings), but the latter one gave me the segfault much later during the encode (it almost got the entire video done, except for the last few minutes).

I even added the -ffourcc XVID option to my script, and as you can see from my previous output post, I'm running the script as sudo (just to make sure there aren't any silly file write permission errors).

Still no go.

Any other suggestions?
   
Reply With Quote
  (#32 (permalink)) Old
NinjitsuStylee Offline
New Member
 
Posts: 7
Join Date: Jun 2006
Location: Chicago
Model: 8100
Carrier: Tmobile
Default 06-14-2007, 10:38 PM

Hm.

I replaced FILE=$1 with FILE=myfile.avi

...and it worked.

/shrug

Guess we're good to go!
   
Reply With Quote
  (#33 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 06-14-2007, 10:52 PM

Quote:
Originally Posted by NinjitsuStylee View Post
I replaced FILE=$1 with FILE=myfile.avi
...and it worked.
That's .... odd. Try changing it to FILE="$1", then remove the quotes around "$FILE" as the first param to mencoder, see what that does; it's odd in that it starts working, then stops (which you think would not be a quoting/filename problem).

My mencoder is whatever FreshRPMS (http://freshrpms.net) happens to have, which is usually the latest available. To be honest I never even think about it, never having had a problem - the on here on Fedora 7 is '1.0rc1-4.1.2', even newer than that one on FC6 at work.
   
Reply With Quote
  (#34 (permalink)) Old
erroneus Offline
Knows Where the Search Button Is
 
erroneus's Avatar
 
Posts: 42
Join Date: Feb 2007
Location: Texas
Model: 8100
Carrier: T-Mobile
Default 08-05-2007, 09:04 AM

I've been using the script above for quite a while with minor tweaks here and there for aspect ratio and stuff like that. But recently some update broke the thing and the fix was to add the following to the mencoder command line:

-srate 16000

I'm not sure what it does exactly but it worked. Actually, -srate 8000 was what I had originally, but when I played it back on the BB, there was no sound. So I doubled it and the sound worked.


Device: Blackberry 8100 v4.2.0.64
Carrier: T-Mobile USA
BES: 4.1.0.38
Desktop OS: Fedora 7 Linux, Windows XP (vmware)
   
Reply With Quote
  (#35 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 08-05-2007, 01:10 PM

Quote:
Originally Posted by erroneus View Post
But recently some update broke the thing and the fix was to add the following to the mencoder command line:

-srate 16000

I'm not sure what it does exactly but it worked. Actually, -srate 8000 was what I had originally, but when I played it back on the BB, there was no sound. So I doubled it and the sound worked.
Hmmm, the manpage says:

Code:
       -srate <Hz>
              Selects the output sample rate to be used (of course sound cards
              have  limits on this).  If the sample frequency selected is dif-
              ferent from that of the current media, the resample  or  lavcre-
              sample audio filter will be inserted into the audio filter layer
              to compensate for the difference.  The type of resampling can be
              controlled  by  the  -af-adv option.  The default is fast resam-
              pling that may cause distortion.
I'm no audio engineer but it might be that your input audio has a sampling rate that is beyond the capability of the BB device (like maybe you have 48kHz and the BB can only handle 44.1kHz) and during the conversion it's not being downsampled. I would try a higher setting that 16kHz, that's awful. Try with '-srate 22050' or '-srate 44100' (22.05 kHz and 44.1kHz) and see how that works out.

BTW, feel free to post additions to the script!
   
Reply With Quote
  (#36 (permalink)) Old
tuxi Offline
New Member
 
Posts: 7
Join Date: Mar 2007
Location: Katy, TX
Model: 8800
Carrier: AT&T
Default Modifications to use Ubuntu 7.10 - 01-19-2008, 02:14 PM

When I tried to use vid2bb.sh in Ubuntu, I'd get the following message:
Code:
Audio LAVC, couldn't find encoder for codec mp3.
With some poking around, I found the following parameters within the mencoder line in the script to work:
Code:
mencoder "$FILE" \
        -o "${FILE%.*}_bb.avi" \
        -of avi \
        -ovc lavc \
        -oac mp3lame \
        -lavcopts vcodec=mpeg4:vbitrate=$VBR:acodec=aac:abitrate=$ABR \
        -vf scale=$RES
Using mp3lame gave me a usable video with audio that was fine. There may be some fine tuning for this, but I haven't done too much more fiddling with it.


Tuxi
BlackBerry 8800
AT&T
BES (version unknown)
Windows XP, Ubuntu 8.10
   
Reply With Quote
  (#37 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 01-19-2008, 06:34 PM

Quote:
Originally Posted by tuxi View Post
Code:
        -oac mp3lame \
Using mp3lame gave me a usable video with audio that was fine. There may be some fine tuning for this, but I haven't done too much more fiddling with it.
Yeah, mencoder/mplayer can be compiled with all sorts of different stuff, it's a very confusing set of options they've got going on. If you need to use -oac mp3lame, then you want a line with -lameopts for the bitrate (and anything else), like so:

Code:
        -oac mp3lame \
        -lameopts abr:br=$ABR \
...and edit the -lavcopts line to remove the audio options now:

Code:
        -lavcopts vcodec=mpeg4:vbitrate=$VBR
Complete:
Code:
mencoder "$FILE" \
        -o "${FILE%.*}_bb.avi" \
        -of avi \
        -ovc lavc \
        -oac mp3lame \
        -lavcopts vcodec=mpeg4:vbitrate=$VBR \
        -lameopts abr:br=$ABR \
        -vf scale=$RES
Obviously tweak the -lameopts as much as you'd like and/or need, but the defaults should work pretty good.
   
Reply With Quote
  (#38 (permalink)) Old
berry much Offline
Knows Where the Search Button Is
 
Posts: 28
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: ATT
Default 05-19-2008, 06:21 PM

thanks for this, it's very helpful! any idea what is the max supported video or audio bitrates, or does this vary by device?
   
Reply With Quote
  (#39 (permalink)) Old
rivviepop Offline
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Posts: 2,166
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Default 05-19-2008, 07:05 PM

Quote:
Originally Posted by berry much View Post
thanks for this, it's very helpful! any idea what is the max supported video or audio bitrates, or does this vary by device?
It pretty much varies, but the ones I listed are "safe" for most devices; you can just start edging upwards from there and see how much your device can handle. It's also very video-specific; I have a few that worked great on my 8100 but I still can't get them to work right on my 8320, which has been frustrating. The select ones not working for me are all WMV original containers, which makes me wonder...
   
Reply With Quote
  (#40 (permalink)) Old
Ashex Offline
Knows Where the Search Button Is
 
Posts: 25
Join Date: Jun 2008
Model: 8130
PIN: N/A
Carrier: Sprint
Default 06-11-2008, 05:13 PM

I converted an AVI video using the modified verison you posted for ubuntu. For some reason I keep getting the error "An error has occured attempting to play media".

My phone has v4.3.0.127
   
Reply With Quote
Reply


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright © 2004-2009 BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.