LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-24-2009, 07:15 PM   #1
angelosbg
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Rep: Reputation: 0
Video Problem-Picture delay


I have installed Linux Mint for the first time,so you can understand that I am a newbie.
I have a problem with every player I use.
When I watch an avi,an mpeg or whatever the picture has a small delay compared to sound.I have installed the ubuntu r4estricted extras and I didn;t find a solution.


What else can you suggest?
 
Old 01-25-2009, 04:19 PM   #2
arckane
Member
 
Registered: Sep 2005
Location: UK
Distribution: Gentoo/Debian/Ubuntu
Posts: 308

Rep: Reputation: 39
What is your hardware config and have you tested all with the same file? Are you sure the file isn't the issue?

Mplayer will allow you to adjust to audio and video sync using - and +.
 
Old 01-26-2009, 04:27 AM   #3
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
Are you sure you have disk-DMA enabled for your board?

Open a terminal and do

Code:
/sbin/hdparm -i /dev/hdb
(if you harddisk is at hdb - yours is likely to be somewhere else - to find it do in a terminal
Code:
df -mh
)

Your output should look something like this:

Code:
[root@development ~]# /sbin/hdparm -i /dev/hdb

/dev/hdb:

 Model=ST380011A, FwRev=8.01, SerialNo=5JVDB3XC
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
 BuffType=unknown, BuffSize=2048kB, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=156301488
 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: ATA/ATAPI-6 T13 1410D revision 2:  ATA/ATAPI-1 ATA/ATAPI-2 ATA/ATAPI-3 ATA/ATAPI-4 ATA/ATAPI-5 ATA/ATAPI-6

 * signifies the current active mode

[root@development ~]#
I. e. I have UDMA5 active on my harddisk. Slight audio / video delays can be caused if you do NOT have DMA enabled...
 
Old 01-26-2009, 05:31 AM   #4
angelosbg
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Original Poster
Rep: Reputation: 0
/dev/sda3:

Model=Maxtor 6E030L0 , FwRev=NAR61590, SerialNo=E103GEHE
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57
BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=?16?
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=60058656
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 *udma2 udma3 udma4 udma5 udma6
AdvancedPM=yes: unknown setting WriteCache=enabled
Drive conforms to: ATA/ATAPI-7 T13 1532D revision 0: ATA/ATAPI-1,2,3,4,5,6,7

* signifies the current active mode


What thoughts can you make from this?



Also,I have problems with all the files,it is not with a special one.
 
Old 01-27-2009, 06:09 AM   #5
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
Quote:
Originally Posted by angelosbg View Post
/dev/sda3:
Model=Maxtor 6E030L0 , FwRev=NAR61590, SerialNo=E103GEHE
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57
BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=?16?
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=60058656
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 *udma2 udma3 udma4 udma5 udma6
AdvancedPM=yes: unknown setting WriteCache=enabled
Drive conforms to: ATA/ATAPI-7 T13 1532D revision 0: ATA/ATAPI-1,2,3,4,5,6,7

* signifies the current active mode
Hmm - it seems that the kernel thinks that your drive is capable of being at least 3 times faster - can you see if you compare my output with yours, your drive is currently in UDMA2 mode, NOT UDMA6 (which is it maximum speed).

This could be why you have lagging and apparent frame drops - your drive's DMA speed is at least 3 times slower then it could be (at least, that's how it appears to me - I could be wrong).

You need to set your drive to use the maximum UDMA6 mode it seems to be capable of.

Try doing

Code:
/sbin/hdparm -d1 -c1 /dev/sda3
and then again do

Code:
/sbin/hdparm -i /dev/sda3
to see if it has selected a higher UDMA setting.

Last edited by rylan76; 01-27-2009 at 06:11 AM.
 
Old 01-28-2009, 04:42 AM   #6
angelosbg
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Original Poster
Rep: Reputation: 0
The result of sudo /sbin/hdparm -d1 -c1 /dev/sda3


/dev/sda3:
setting 32-bit IO_support flag to 1
HDIO_SET_32BIT failed: Invalid argument
setting using_dma to 1 (on)
HDIO_SET_DMA failed: Inappropriate ioctl for device
IO_support = 0 (default)
HDIO_GET_DMA failed: Inappropriate ioctl for device


And the result of sudo /sbin/hdparm -i /dev/sda3

/dev/sda3:

Model=Maxtor 6E030L0 , FwRev=NAR61590, SerialNo=E103GEHE
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57
BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=?16?
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=60058656
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 *udma2 udma3 udma4 udma5 udma6
AdvancedPM=yes: unknown setting WriteCache=enabled
Drive conforms to: ATA/ATAPI-7 T13 1532D revision 0: ATA/ATAPI-1,2,3,4,5,6,7

* signifies the current active mode
 
Old 01-30-2009, 12:26 AM   #7
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
Hmm - what does

Code:
/sbin/hdparm -t /dev/sda3
report?

Mine (with a relative old AMD Barton system with 1GB of RAM):

[code]
[root@development ~]# /sbin/hdparm -t /dev/hdb1

/dev/hdb1:
Timing buffered disk reads: 152 MB in 3.02 seconds = 50.39 MB/sec
[root@development ~]#
[code]

If your system (despite not being (apparently) in full speed DMA mode, reports a faster result - more MBs/sec) then your jerky video problem is NOT DMA related (I think). This system (at 50.39 MB throughput should handle DVD viewing and viewing of video files off disk, using mplayer, at no jerkiness at normal system loads).

The fact that your hdparm is reporting an invalid ioctl can possibly mean that the kernel does not support full-speed DMA for your disks... what kernel version are you running?

To find the kernel version do in a terminal

Code:
uname -r
also, what is your load average?

In a terminal, do

[code]
uptime
[code]

Mine:

Code:
[root@development ~]# uptime
 08:28:29 up 56 min,  1 user,  load average: 0.51, 0.47, 0.36
[root@development ~]#
The

Code:
0.51, 0.47, 0.36
indicates that my system is relatively unloaded, if you see numbers around 1 or 2 it means that your system is relatively heavily loaded, and might have problems with realtime stuff like decoding video and audio - which can lead to jerkiness.

Last edited by rylan76; 01-30-2009 at 12:29 AM.
 
Old 02-06-2009, 06:43 AM   #8
angelosbg
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Original Poster
Rep: Reputation: 0
When I give sudo /sbin/hdparm -t /dev/sda3


I have :Timing buffered disk reads: 92 MB in 3.07 seconds = 30.02 MB/sec



For the kernel version


2.6.27-7-generic



And with uptime



14:40:10 up 4 days, 16:30, 2 users, load average: 0.89, 1.00, 0.92


However I don't thnik that the last one is the problem
 
Old 02-11-2009, 08:53 AM   #9
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
Well, your disk transfer is at least 20MB/sec slower - and I think I have a VERY much older system. So your bottleneck seems to be your DMA... your system simply cannot transfer data from the disk fast enough so that the relevant player can keep a smooth framerate. You probably need a kernel recompile with a motherboard DMA driver active that will be able to drive your local DMA hardware so that it will actually DO its best DMA speed... so you can transfer data fast enough from disk so a player won't stutter all the time.
 
Old 02-12-2009, 05:49 PM   #10
angelosbg
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Sorry for asking or probably "breaking your balls" but I am not exactly what is called computer freak so I cannot understand exactly what to do.Can you explain to me in simpler words?
 
Old 02-13-2009, 07:30 AM   #11
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
What you need to do is to first, make sure that your kernel source packages are installed. Can't really help you there, it depends on your distro and how your system was initially set up.

Anyway, once these are installed, (at least on Fedora Core 6) they should reside in

/usr/src/kernels/linux-2.6.18.1

or whatever version of the kernel whose source packages you have installed.

What you then need to do is

1. Configure the kernel to (maybe) have support for your motherboard's DMA
2. Compile and Install the new kernel
3. Boot into the new kernel
4. Test DMA with a video player

This is exactly how, on my old Gigabyte TRS350MT motherboarded PC I managed to get DMA working, and eventually got smooth video playback / DVD playback on Fedora Core 3 on the TRS350MT motherboard.

First, your current kernel. Most likely, if you have a normal / mass distributed distro like Fedora, Mandrake, Suse, etc. the kernel will be very much configured in a "generalised" way, i. e. the hardware it supports and the way it operates is as general as possible to please as many people as possible. What happened to me on Fedora Core 3 was -exactly- what you describe your problem as being. Other guys also told me to try

Code:
/sbin/hdparm -d1 -c1 /dev/dvd
to try and set DMA up on my DVD drive. It failed with the same HDIO errors you seem to get.

So I started looking into recompiling the kernel so that it would do DMA. After days of searching and looking, I finally discovered that the stock kernel that came with my FC3 would NOT ever do DMA with the TRS350MT motherboard, because the kernel did not have support for the ATI IXP southbridge chips on that board. So I went to kernel.org and downloaded the 2.6.18.1 kernel, which was current at that time.

I. e. your current kernel might not have support for the hardware you have, you may need to get a newer kernel from kernel.org as well...

Ok, step by step:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1. Configure the kernel to (maybe) have support for your motherboard's DMA

To do this you first need to know WHAT type of southbridge chipset you have on your motherboard. I had an ATI IXP southbridge (looked up in my motherboard manual).

I. e. , as root do

Code:
[root@development ~]# cd /usr/src/kernels/linux-2.6.18.1/
[root@development linux-2.6.18.1]# make clean
[root@development linux-2.6.18.1]# make mrproper
[root@development linux-2.6.18.1]# make menuconfig
You will now be taken into a text interface where you can configure the kernel. Alternatively, for a graphical interface, do

Code:
[root@development linux-2.6.18.1]# make xconfig
It is your choice.

In the interface you now have before you, either graphical or text based, configure your kernel. Usually it is best to leave most things as they are, you should have pretty good defaults. However, if you want to experiment, go ahead. But as for the point of the whole effort, go the block devices / DMA section (if I remember right - I did this quite a while ago). Look for any and all settings referring to DMA and / or block devices and make sure DMA is enabled / on everywhere. Additionally, look for the name of your chipset.

For example, in menuconfig, I could not find my ATI IXP chipset (it WAS there, but it was hidden between hundreds of other options). So what I did was to configure the kernel with menuconfig, and then, OUTSIDE menuconfig I looked for the string "IXP" with VI to find the entry I needed to change.

I. e. when you exit menuconfig, your kernel configuration is saved into a file called

Code:
.config
in the kernel directory (in my case /usr/src/kernels/linux-2.6.18.1/)

So once you are back at the root prompt do

Code:
[root@development linux-2.6.18.1]# vi .config
To see your .config file "in the raw". What I did here was use the / command in vi (for search) and I found the line referring to IXP. It looked something like this

Code:
ATI_IXP_DMA_SUPPORT=N
I. e. that kernel, if I had compiled it then, would STILL not have had DMA support for my chipset. So I changed that line to

Code:
ATI_IXP_DMA_SUPPORT=Y
Note that this can sometimes cascade a bit, i. e. in step 2 (which we'll get to right now) you might get asked a few more questions once you start compiling the kernel, based on changes you might have made "yourself" to .config.

I. e. for your chipset, if you can find out what your motherboard has, do as I did... it might just work for your too, and spare you hours of trial and error.

Anyway, I then saved this .config file with the change manually made as detailed above (i. e. without using menuconfig or xconfig)

One more thing before you are ready to compile is to edit the kernel makefile, to give your kernel a unique name (so, when you boot your system, you'll know which is which).

After editing .config, do

Code:
[root@development linux-2.6.18.1]# vi Makefile
The top of the file should look something like this:

Code:
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 18
EXTRAVERSION = .1_Vol_No_Preempt
NAME=No Preempt Polar Design
Put your own stuff / name in the

Code:
EXTRAVERSION =
NAME=
fields. These will then be used by the kernel when you install it, and you'll see the NAME and EXTRAVERSION fields displayed in your GRUB menu when you boot your system after installing the new kernel (so you'll know WHICH kernel to start - you give it a unique name).

NOTE THAT I AM ASSUMING YOU WILL USE GRUB AS BOOTLOADER!

2. Compile and Install the new kernel

Ok, after editing the Makefile and giving your kernel a unique, recognisable name, start the compile process.

This is done like this:

Code:
[root@development linux-2.6.18.1]# make all
Note that the above can take a LONG time - up to an hour or two if you have a very slow system. On most modern PCs, expect to wait AT LEAST 20 minutes or so for the kernel to compile. You should get no errors, and maybe one or two warnings. Warnings can usually be safely ignored. You won't be able to ignore errors, the compilation will stop and you WILL be stuck. If that happens you might have selected some option somewhere in xconfig or menuconfig that won't work on your setup / hardware (which is why it is unwise, if you don't feel adventurous or patient enough, to edit the default kernel's settings TOO much)

Note that, as I said earlier, the compilation process might stop here and there and ask you a question. You can usually choose between the general logical options of yes, no, auto, or force. If you are unuse, always leave at auto.

Once the kernel compile has finished and you have the # back, do

Code:
[root@development linux-2.6.18.1]# make modules_install
The above can again take a few minutes, then, the final step

Code:
[root@development linux-2.6.18.1]# make install
This should install the kernel into GRUB, and add a GRUB bootlist entry.

That's it! You have now compiled and installed your new kernel.

3. Boot into the new kernel

Simply restart your machine. When GRUB now comes up, you should see your stock kernel (the one that came with your distro) AND -your- kernel, the one you just compiled. Choose "your" kernel, and hopefully if all went well, your system will start up with the new kernel you compiled yourself, running the "show".

4. Test DMA with a video player

NOW try to do a

Code:
 /sbin/hdparm -d1 -c1 /dev/dvd
again - IF everything went as planned, your "HDIO_" error messages should be gone, OR your DMA speed might already be at its max. Start up your video player and see if there was any improvement.

NOTE: It is possible that "your" kernel might fail to boot or that your system won't start with the new kernel. Don't panic, simply reboot again and from the GRUB menu choose your "old, known as working" kernel. That's the beauty of playing around with the kernel, if you foul up, it is dead easy to just start your old, working kernel, and use THAT again to fiddle with the new custom kernel.

One advantage of this of course is when you are configuring your new kernel, you can set it up EXACTLY like you want. For example, I dropped many, many drivers and services and filesystems from my custom kernel, because I knew I'd never need them. This resulted in a smaller, and maybe a tiny bit faster kernel. Not as important these days, sure, with everybody having a gargantuan PC, but back then it mattered a lot if you could cut a few kilobytes or CPU cycles out of the kernel so you could have more horses available to do actual work.

Hope this helped!

Regards,
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Video delay in MPlayer? SentralOrigin Linux - Software 1 09-24-2008 03:04 PM
noatun and desktop sounds: big delay between picture and sound? lugoteehalt Linux - Desktop 7 09-18-2008 01:12 PM
tv-out through s-video only gives black and white picture. Synt4x_3rr0r Linux - Desktop 1 06-17-2008 10:22 AM
Horrible picture video files Namingishard Ubuntu 1 07-31-2006 03:16 PM
Video Camera / Where are picture in my memory darky42 Programming 0 04-04-2002 05:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration