android
  #1  
Old 01-02-2009, 03:18 PM
zen_in_linux zen_in_linux is offline
Junior Member
 
Join Date: Jan 2009
Posts: 4
Default Video Conversions With Linux

Here are some initial thoughts on using the Creative Zen in Linux to add to some of the very useful information elsewhere in this forum.

I am using Suse 11.0.

I used the udev (hotplug) rules described on this site http://www.mossroot.com/worlds/2008/...x-fi-to-linux/. Having followed the guidance on that site, I found I could easily mount the Zen X-fi as part of the Linux filesystem. I created the directory $HOME/zen and then from $HOME issued the command mtpfs zen which meant I could browse the filesystem from the command line or using a file manager (Konqueror). Not all file operations are available: you can create directories and add files but you can't seem to be able to use mv or overwrite a file (not a major issue).

Having spent a while experimenting with ffmpeg and mencoder I have had success with the following scripts.

This is using mencoder for two-pass encoding of a 16:9 video to divx with no change to the audio:

mencoder [infile] -vf scale=320:180,harddup -of avi -ffourcc DIVX -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o /dev/null

mencoder [infile] -vf scale=320:180,harddup -of avi -ffourcc DIVX -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:mbd=2:trell -oac copy -o [outfile]

One of the essential elements of this script is the -ffourc option. I couldn't get the transcoding to work with the libavcodec codecs (i.e. -ovc lavc) without that option.

The mencoder -ffourcc option in ffmpeg is -vtag. The following also worked for me (this time on a 4:3 video):

ffmpeg -i [infile] -f avi -vtag DIVX -r 30 -s 320x240 -vcodec mpeg4 -b 1000K -acodec libmp3lame -ab 320K [outfile].avi

For those interested in downloading and transcoding Youtube videos there is an excellent command-line utility called clive which I installed using the Suse installation utility zypper. Further details are available here

The clive utility has a command-line re-encoding option, meaning you can have a single command line for downloading a Youtube video, transcoding it, and outputting the result onto your Zen mounted in Linux.

Last edited by zen_in_linux; 01-03-2009 at 09:23 AM.
Reply With Quote

Advertisement [Remove Advertisement]

  #2  
Old 02-20-2009, 11:01 AM
anthony.phipps anthony.phipps is offline
Junior Member
 
Join Date: Feb 2009
Posts: 2
Page [Guide] Mencoder - Converting Video in Windows and Linux

Linux (Fedora 10 tested)
Install mencoder (sudo apt-get mencoder or su -c 'yum install mencoder')
these are bash scripts. Save the text to a file, then make it executable in it's properties.
Rip a DVD straight to Zen compatible
Code:
#!/bin/bash
# Author: Anthony Phipps < anthony[dot]james[dot]phipps[at]gmail[dot]com
# Title: DVD Rip Script
# Version: 0.3
# Description: Rip a DVD

NAME=`zenity --entry --title="DVD Name" --text="Whats the DVD name?"`
FILENAME=`basename "$NAME"`
OUTPUT="/home/$USER/Videos/$FILENAME.avi"

mencoder dvd://1 -aid 128 \
-vf scale="320:-11",pullup,softskip,harddup \
-ovc xvid -xvidencopts threads=2:bvhq=1:chroma_opt:quant_type=mpeg:bitrate=500:pass=1 \
-oac mp3lame -lameopts br=96:cbr \
-o /dev/null \
; \
 mencoder dvd://1 -aid 128 \
-vf scale="320:-11",pullup,softskip,harddup \
-ovc xvid -xvidencopts threads=2:bvhq=1:chroma_opt:quant_type=mpeg:bitrate=500:pass=2 \
-oac mp3lame -lameopts br=96:cbr \
-o "$OUTPUT"

zenity --info --title="Encoding Completed" --text="$INPUT successfully encoded to $OUTPUT"
Convert an existing movie to Zen compatible
Code:
#!/bin/bash
# Author: Anthony Phipps < anthony[dot]james[dot]phipps[at]gmail[dot]com
# Title: Creative Zen Video Converter Script
# Version: 0.5
# Description: Converts video into a format suitable for transfer to the Creative Zen

INPUT=`zenity --file-selection --title="Select the file to Convert"`
FILENAME=`basename "$INPUT"`
OUTPUT="/home/$USER/Videos/Zen/$FILENAME.avi"

mencoder "$INPUT" \
-vf scale=320:-11 \
-ovc xvid -xvidencopts threads=2:bvhq=1:chroma_opt:quant_type=mpeg:bitrate=500:pass=1 \
-oac mp3lame -lameopts br=96:cbr \
-o /dev/null \
 \
;mencoder "$INPUT" \
-vf scale=320:-11 \
-ovc xvid -xvidencopts threads=2:bvhq=1:chroma_opt:quant_type=mpeg:bitrate=500:pass=2 \
-oac mp3lame -lameopts br=96:cbr \
-o "$OUTPUT"

zenity --info --title="Encoding Completed" --text="$INPUT successfully encoded to $OUTPUT"
convert an entire directory of videos to zen compatible. Put this script in the directory and run it from there.
Code:
#!/bin/bash
# Author: Anthony Phipps < anthony[dot]james[dot]phipps[at]gmail[dot]com
# Title: Creative Zen Video Batch Converter Script
# Version: 0.5
# Description: Converts videos in a directory into a format suitable for transfer to the Creative Zen


mkdir /home/$USER/Videos/Zen
for movie in *.* ; do

FILENAME=`basename "$movie"`
OUTPUT="/home/$USER/Videos/Zen/$FILENAME.avi"

mencoder "$movie" \
-vf scale=320:-11 \
-ovc xvid -xvidencopts threads=2:bvhq=1:chroma_opt:quant_type=mpeg:bitrate=500:pass=1 \
-oac mp3lame -lameopts br=96:cbr \
-o /dev/null \
 \
;mencoder "$movie" \
-vf scale=320:-11 \
-ovc xvid -xvidencopts threads=2:bvhq=1:chroma_opt:quant_type=mpeg:bitrate=500:pass=2 \
-oac mp3lame -lameopts br=96:cbr \
-o "$OUTPUT"

done

zenity --info --title="Encoding Completed" --text="Done!"
Windows (XP and Server 2003 tested)
To install mencoder, you just download the mplayer zip file and extract it somewhere (c:\mplayer in this example). It contains both mplayer and mencoder. If you want to use the exact scripts below, move your input files to c:\mplayer\input. Open notepad and paste each of the below scripts in. One at a time, save them as c:\mplayer\script1.bat and c:\mplayer\script2.bat, then run script1.bat to start the batch process.
Script1.bat
Code:
cd c:\mplayer\input
for /f %%a IN ('dir /b *.avi, *.divx, *.mp4, *.mov') do call c:\mplayer\script2.bat %%~na %%~x
Script2.bat
Code:
cd c:\mplayer
del divx2pass.log
mencoder c:\mplayer\input\%1%2 -vf scale=320:-11 -ovc xvid -xvidencopts threads=5:bvhq=1:chroma_opt:quant_type=mpeg:bitrate=500:pass=1 -oac mp3lame -lameopts br=96:cbr -o c:\mplayer\divx2pass.log
mencoder c:\mplayer\input\%1%2 -vf scale=320:-11 -ovc xvid -xvidencopts threads=5:bvhq=1:chroma_opt:quant_type=mpeg:bitrate=500:pass=2 -oac mp3lame -lameopts br=96:cbr -o "c:\mplayer\output\%1.avi"
The above script won't work if you have spaces in your video names, so here is a .vbs script to change the spaces to underscores to allow processing. Open notepad, paste the code in, save to c:\mplayer\input\renamer.vbs and run it before the above scripts.
Code:
                 '========================================================
' VBScript to replace underscore in file name with space 
' for each files in a folder
' Written by ApOgEE of http://coderstalk.blogspot.com
'========================================================
Dim sName
Dim fso
Dim fol

' create the filesystem object
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
    
' get current folder
Set fol = fso.GetFolder(".")

' go thru each files in the folder
For Each fil In fol.Files
    ' check if the file name contains underscore
    If InStr(1, fil.Name, " ") <> 0 Then
        ' replace underscore with space
        sName = Replace(fil.Name, " ", "_")
        ' rename the file
        fil.Name = sName
    End If
Next

' echo the job is completed
' WScript.Echo "Completed!"
Known issues:
Linux - Every time I transfer a video using gnomad2 it fails to copy the index, preventing you from seeking through the video. To fix this, I can either copy it to an SD card and use that, or use windows to copy the video off, then back on to the zen. Either solution will allow you to seek properly. This is not a problem with mencoder, but gnomad2.

Please inform me of any imperfections or improvements. There may be a typo or two, nobody is perfect =P

Last edited by anthony.phipps; 02-20-2009 at 11:12 AM. Reason: added vbs for renaming input files
Reply With Quote

  #3  
Old 03-05-2009, 07:51 AM
freddybob freddybob is offline
Junior Member
 
Join Date: Apr 2008
Posts: 6
Default

I've found a very simple GUI way to convert videos for my Zen in Ubuntu.

ZenCoder: http://www.cimitan.com/blog/2008/08/...-creative-zen/

Very few configuration options (but maybe that's a good thing) just drag videos into ZenCoder and it creates a Zen compatible file in the source folder.
Reply With Quote

  #4  
Old 03-05-2009, 12:34 PM
BobbyRS's Avatar
BobbyRS BobbyRS is offline
Ultra Senior Member
 
Join Date: Oct 2007
Location: USA
Posts: 6,575
Default

Thanks for your post guys. Very helpful information!
__________________
.
~Light travels faster than sound, which is why some people appear to be bright until they speak~

Zen FAQ
Reply With Quote

  #5  
Old 03-20-2009, 07:30 PM
ChrisV2 ChrisV2 is offline
Junior Member
 
Join Date: Oct 2008
Posts: 9
Default

I just posted this link for a script I created in the 'Zen' forum (didn't know about the 'Zen Video' forum until I just searched on 'linux' a few minutes ago).

http://www.woodjoiner.com/encoding/

If someone would check it out and let me know if it works on their Linux system that would be cool. I included a zoom feature that allows you to selectively go from widescreen to 4:3 or anything inbetween so you get to pick the cropping plan for fitting widescreen movies to the Zen's 4:3 aspect ratio.

Thanks,
Chris
Reply With Quote

  #6  
Old 09-07-2011, 04:35 PM
rcpp rcpp is offline
Junior Member
 
Join Date: Sep 2011
Location: Brazil
Posts: 3
Default

Hi guys! I tried to convert one DVD I own to MPEG-4 so I can watch it on my trip next week. So far, I've tried 5 times to no avail - I always get sync problems with A/V. The audio is way behind.

When playing on my PC, everything runs fine. The conversation was made with K9Copy. This is how mplayer output it:
Quote:
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing test.avi.
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO: [XVID] 640x272 12bpp 30.000 fps 634.3 kbps (77.4 kbyte/s)
Clip info:
Software: MEncoder SVN-r1.0~rc3+svn20090426-4.4.3
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
[VO_TDFXFB] Can't open /dev/fb0: Permission denied.
[VO_3DFX] Unable to open /dev/3dfx.
================================================== ========================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
================================================== ========================
================================================== ========================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
================================================== ========================
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
Starting playback...
VDec: vo config request - 640 x 272 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [xv] 640x272 => 640x360 Planar YV12
The original video is in 16:9, so I tried using 640x272... no success.

I did another try with 480x320 aspect ratio:

Quote:
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO: [XVID] 480x320 12bpp 29.970 fps 907.2 kbps (110.7 kbyte/s)
Clip info:
Software: MEncoder SVN-r1.0~rc3+svn20090426-4.4.3
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
[VO_TDFXFB] Can't open /dev/fb0: Permission denied.
[VO_3DFX] Unable to open /dev/3dfx.
================================================== ========================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
================================================== ========================
================================================== ========================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
================================================== ========================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback...
VDec: vo config request - 480 x 320 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [xv] 480x320 => 568x320 Planar YV12
No success either. The other tries was also with 480x320 and using 44khz audio. Same sync problems.

What is funny is that every video is having the same sync audio delay. Not faster, nor slower. Any ideas? This is how I configured the codec:

Audio: -oac mp3lame -lameopts br=128:cbr -af resample=44100 -srate 44100


Video:
1st pass:
-ovc xvid -xvidencopts bitrate=$VIDBR:turboass=$PASS:aspect=$ASPECT -vf crop=$CROPWIDTH:$CROPHEIGHT:$CROPLEFT:$CROPTOP,sca le=$WIDTH:$HEIGHT,dsize=$ASPECT -ofps 30


2nd pass:


-ovc xvid -xvidencopts bitrate=$VIDBR:turboass=$PASS:aspect=$ASPECT -vf crop=$CROPWIDTH:$CROPHEIGHT:$CROPLEFT:$CROPTOP,sca le=$WIDTH:$HEIGHT,dsize=$ASPECT -ofps 30




Using 800kbps for the video.







Cheers all!


EDIT: source details:

Quote:
MPEG-PS file format detected.
VIDEO: MPEG2 720x480 (aspect 2) 29.970 fps 8000.0 kbps (1000.0 kbyte/s)
================================================== ========================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 720 x 480 (preferred colorspace: Mpeg PES)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
VDecoder init failed
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Unsupported PixelFormat -1
Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2)
================================================== ========================
================================================== ========================
Opening audio decoder: [liba52] AC3 decoding with liba52
Using SSE optimized IMDCT transform
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000)
Selected audio codec: [a52] afm: liba52 (AC3-liba52)
================================================== ========================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback...
VDec: vo config request - 720 x 480 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [xv] 720x480 => 720x540 Planar YV12

Last edited by rcpp; 09-07-2011 at 04:40 PM.
Reply With Quote

Reply

Tags
creative zen, ffmpeg, linux, mencoder, video, zen, zen video, zen x-fi

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump



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