Wednesday, July 25, 2007

Wine là gì ? Cùng tìm hiểu về Wine trong Linux và Ubuntu

1 .Khó khăn từ Window và Linux
Những pần mềm khác nhau được thiết kế cho những hệ điều hành( OS) khác nhau, và hầu như ko chạy trên những OS khác mà chúng đã được thiết kế. Dí dụ, các software xài cho Win ko chạy trên nền Linux được, bởi vì nó chứa những lệnh mà Linux ko hiểu hay ko có thư viện hỗ trợ cho tới khi nó được biên dịch trong môi trường Window. Những software của Linux cũng như zậy, Window OS ko hiểu hết những tất cả những lệnh của nó.
Trường hợp này đã bộc lộ vấn đề cơ bản cho những ai muốn chạy chương trình trong cả 2 OS Linux và Window. Một giải pháp phổ biến cho vấn đề này là cùng cài cả 2 OS trong máy, được gọi như là "dual booting"( tam dịch là "khởi động kép"). Khi cần chạy 1 software của Window thì chuyển qua Win OS, nếu cần chạy 1 software của Linux thì bạn phải restart lại Linux OS. Lựa chọn này gây ra khó khăn lớn cho người dùng cuối bởi việc tái khởi động máy nhiều lần, những chương trình viết cho cả 2 OS ko thể chạy đồng thời. Hơn nữa những chương trình chạy trên Window thường rất mắc( cái này Vietnamese chắc ko thành vấn đề j !), yêu cầu phân vùng ổ cứng khác nhau, nên ko thể đọc hầu hết các kiểu định dang file hệ thống, làm cho việc share dữ liệu trở nên khó khăn jữa những OS.
2. Wine là gì ?
Wine làm cho những chương trình của Window có thể chạy song song với bất kì OS giống Unix và Linux nói riêng. Thực ra, Wine là một sự thực thi của thư viện Windows Application Programing Interface (API), hoạt động như 1 cầu nối juã7 Windos và Linux. Bạn hãy nghĩ Wine như 1 lớp tương thích, khi 1 software Window yêu cầu thực thi 1 hàm mà Linux ko hiểu một cách thông thường, Wine sẽ dịch lệnh của chương trình vào 1 trình hỗ trợ của nó bởi hệ thống. Cho ví dụ, nếu chương trình yêu cầu hệ thống tạo ra 1 pushbutton hay 1 trường text-edit, Wine sẽ chuyển lệnh đó thành những lệnh tương đương của Linux trong dạng 1 lệnh đến trình quản lí cửa sổ dùng giao thức chuẩn X11.
Nếu bạn fải truy xuất mã nguồn của những chương trình Window, Wine có thể cũng được dùng để biên dịch ngược( recompile) chương trình vào 1 dạng mà Linux có thể hiểu một cách dễ dàng hơn. Wine vẫn cần bắt đầu chương trình trong dạng biên dich ngược của nó, tuy nhiên có vài ưu điểm để biên dịch chương trình Window một cách tự nhiên trong Linux.
3.Những đặc tính của Wine :( bữa nào típ ngen)

Bài này tui được dịch từ winehq.org , các bạn có thể xem fiên bản English tại đây

What is Wine ?

1.2.1. Windows and Linux

Different software programs are designed for different operating systems, and most won't work on systems that they weren't designed for. Windows programs, for example, won't run in Linux because they contain instructions that the system can't understand until they're translated by the Windows environment. Linux programs, likewise, won't run under the Windows operating system because Windows is unable to interpret all of their instructions.

This situation presents a fundamental problem for anyone who wants to run software for both Windows and Linux. A common solution to this problem is to install both operating systems on the same computer, known as "dual booting." When a Windows program is needed, the user boots the machine into Windows to run it; when a Linux program is then needed, the user then reboots the machine into Linux. This option presents great difficulty: not only must the user endure the frustration of frequent rebooting, but programs for both platforms can't be run simultaneously. Having Windows on a system also creates an added burden: the software is expensive, requires a separate disk partition, and is unable to read most filesystem formats, making the sharing of data between operating systems difficult.

1.2.2. What is Wine, and how can it help me?

Wine makes it possible to run Windows programs alongside any Unix-like operating system, particularly Linux. At its heart, Wine is an implementation of the Windows Application Programing Interface (API) library, acting as a bridge between the Windows program and Linux. Think of Wine as a compatibility layer, when a Windows program tries to perform a function that Linux doesn't normally understand, Wine will translate that program's instruction into one supported by the system. For example, if a program asks the system to create a Windows pushbutton or text-edit field, Wine will convert that instruction into its Linux equivalent in the form of a command to the window manager using the standard X11 protocol.

If you have access to the Windows program's source code, Wine can also be used to recompile a program into a format that Linux can understand more easily. Wine is still needed to launch the program in its recompiled form, however there are many advantages to compiling a Windows program natively within Linux. For more information, see the Winelib User Guide.

1.2.3. Wine features

Throughout the course of its development, Wine has continually grown in the features it carries and the programs it can run. A partial list of these features follows:

  • Support for running Win32 (Win 95/98, NT/2000/XP), Win16 (Win 3.1) and DOS programs

  • Optional use of external vendor DLL files (such as those included with Windows)

  • X11-based graphics display, allowing remote display to any X terminal, as well as a text mode console

  • Desktop-in-a-box or mixable windows

  • DirectX support for games

  • Good support for various sound drivers including OSS and ALSA

  • Support for alternative input devices

  • Printing: PostScript interface driver (psdrv) to standard Unix PostScript print services

  • Modem, serial device support

  • Winsock TCP/IP networking support

  • ASPI interface (SCSI) support for scanners, CD writers, and other devices

  • Advanced unicode and foreign language support

  • Full-featured Wine debugger and configurable trace logging messages for easier troubleshooting

Mình đã dịch bài này ra tiếng Việt tại đây

Convert .flv (Google Videos) to .mpg using ffmpeg

FFmpeg is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. FFmpeg is developed under Linux, but it can compiled under most operating systems, including Windows. In ubuntu This package contains the ffplay multimedia player, the ffserver streaming server and the ffmpeg audio and video encoder. They support most existing file formats (AVI, MPEG, OGG, Matroska, ASF, …) and encoding formats (MPEG, DivX, MPEG4, AC3, DV, …).

ffmpeg Features

  • ffmpeg is a command line tool to convert one video file format to another. It also supports grabbing and encoding in real time from a TV card.
  • ffserver is an HTTP (RTSP is being developped) multimedia streaming server for live broadcasts. Time shifting of live broadcast is also supported.
  • ffplay is a simple media player based on SDL and on the FFmpeg libraries.
  • libavcodec is a library containing all the FFmpeg audio/video encoders and decoders. Most codecs were developped from scratch to ensure best performances and high code reusability.
  • libavformat is a library containing parsers and generators for all common audio/video formats.

Install ffmpeg Ubuntu

sudo apt-get install ffmpeg

convert .flv to .mpg using ffmpeg

First you need to download your .flv file to a folder and you need to Open a terminal window and go in to the .flv file folder and type the following command

ffmpeg -i jokes.flv -ab 56 -ar 22050 -b 500 -s 320×240 jokes.mpg

jokes.flv is the file you want to convert, so the name must be the same as the source file.You can name jokes.mpg whatever you want as long as it has the .mpg extension.

-b bitrate: set the video bitrate in kbit/s (default = 200 kb/s)

-ab bitrate: set the audio bitrate in kbit/s (default = 64)

-ar sample rate: set the audio samplerate in Hz (default = 44100 Hz)

-s size: set frame size. The format is WxH (default 160×128 )

.Mình đã dịch bài này sang tiếng Việt các bạn có thể xem tại đây .