Mailing List Archive

gmplayer rawvideo settings for PAL
Hi there.

I've been using gmplayer and ivtv to record gameplay videos from my
PS2 (NTSC output I think), and a PVR-150. I was able to find a guide
for it over here:

http://www.gossamer-threads.com/lists/ivtv/devel/36688

So what I'm using for NTSC/My PS2 is basically this:

-------
v4lctl setnorm "NTSC-M"
v4lctl setinput "Composite 1"
aplay -q --buffer-time=0 -f dat /dev/video24 &
gmplayer -rawvideo format=hm12:h=480:w=720:fps=29.97 -nocache -demuxer
26 /dev/video32 -framedrop -vo xv -monitoraspect 16:10
cat /dev/video0 > /tmp/output_vid.mpg
-------

The above basically lets me record to mpg, while playing the video and
audio on my PC, with only a slight lag (I'm not using a TV for the
actual playback).

The problem is that I don't actually understand most of those
settings, but I need to adapt them from NTSC to PAL, to work with my
360.

I think I need to have at least these changes:
- v4lctl setnorm "PAL"
- fps=25
- w=576

But that just shows up as a jumble in gmplayer, so there's probably
more settings that need to be tweaked for PAL output.

Any suggestions? Or do I need to ask this on gmplayer's mailing list?

Thanks,

David.

_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: gmplayer rawvideo settings for PAL [ In reply to ]
On Saturday 23 October 2010, David wrote:

> I've been using gmplayer and ivtv to record gameplay videos from my
> PS2 (NTSC output I think), and a PVR-150. I was able to find a guide
> for it over here:
>
> http://www.gossamer-threads.com/lists/ivtv/devel/36688
>
> So what I'm using for NTSC/My PS2 is basically this:
>
> -------
> v4lctl setnorm "NTSC-M"
> v4lctl setinput "Composite 1"
> aplay -q --buffer-time=0 -f dat /dev/video24 &
> gmplayer -rawvideo format=hm12:h=480:w=720:fps=29.97 -nocache -demuxer
> 26 /dev/video32 -framedrop -vo xv -monitoraspect 16:10
> cat /dev/video0 > /tmp/output_vid.mpg
> -------
>
> The above basically lets me record to mpg, while playing the video and
> audio on my PC, with only a slight lag (I'm not using a TV for the
> actual playback).
>
> The problem is that I don't actually understand most of those
> settings, but I need to adapt them from NTSC to PAL, to work with my
> 360.
>
> I think I need to have at least these changes:
> - v4lctl setnorm "PAL"
> - fps=25
> - w=576

I think you mean h=576.

> But that just shows up as a jumble in gmplayer, so there's probably
> more settings that need to be tweaked for PAL output.

If you did change the width instead of the height to 576 then the output would
be jumbled.

--
Ian

_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: gmplayer rawvideo settings for PAL [ In reply to ]
>
> I think you mean h=576.
>
>> But that just shows up as a jumble in gmplayer, so there's probably
>> more settings that need to be tweaked for PAL output.
>
> If you did change the width instead of the height to 576 then the output would
> be jumbled.
>

Ah, I made a typo in the mail. Actually I did use that height, though
I'm still getting a jumble.

Though actually the picture is mostly recognizable, it just as some
really bad "strobing" / tearing / distortion.

However, I just checked the output video (from cat /dev/video0 >
/tmp/output_vid.mpg), and that looks the same.

So, I think my rawvideo options were mostly correct, and it's actually
some v4lctl option that I need to set.

I did just try using "NTSC" and "SECAM" values with "v4lctl setnorm",
and they look even worse.

Are there some other v4lctl options I should play with? (I'm a
beginner with this).

In case you're interested, here's a link to the mpg, so you can see
the current distorted look

http://wizzardx.isisview.org/uploads/misc/output_vid.mpg

(produced by v4lctl setnorm "PAL", then catting /dev/video0 to the
mpg, for a couple of seconds)

Thanks,

David.

_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: gmplayer rawvideo settings for PAL [ In reply to ]
On Sat, 2010-10-23 at 16:22 +0200, David wrote:
> Hi there.
>
> I've been using gmplayer and ivtv to record gameplay videos from my
> PS2 (NTSC output I think), and a PVR-150. I was able to find a guide
> for it over here:
>
> http://www.gossamer-threads.com/lists/ivtv/devel/36688
>
> So what I'm using for NTSC/My PS2 is basically this:

Hi.

Ian's advice is probably all you need.

Since this is the user's list and I have 5 minutes, I'll walk through
the settings you mentioned:

> -------
> v4lctl setnorm "NTSC-M"
> v4lctl setinput "Composite 1"

Set the capture input for /dev/video0 to the first composite input.
Set the expected analog video standard on the input for /dev/video0
to NTSC-M

Note: these commands are being performed out of order. First switch the
input source and *then* set the expected video standard.

/dev/video0 will be for the first TV capture card in your system. If
that is an ivtv based card, like the PVR-150, the /dev/video0 is the
node from which an MPEG capture is available. Since for ivtv the MPEG
capture node (/dev/video0) and the raw video capture node (/dev/video32)
and the PCM audio capture node (/dev/video24) are all forced to the same
input by hardware and ivtv driver restrictions, this works fine in this
case.

BTW I happen to like the v4l2-ctl command (I've never used v4lctl) since
it is very flexible.

> aplay -q --buffer-time=0 -f dat /dev/video24 &

This command takes captured PCM audio (before the CX23416 chip
compresses it) and plays it through the ALSA sound system.

-f dat tells aplay the Digital Audio Tape (DAT) audio sample rate of 48
ksamples/second is in use. 48 ksps is the default sample rate set by
the ivtv driver for digitizing audio.

-q means "quiet" so messages are suppressed

--buffer-time=0 appear to mean no buffering and no buffering delays


> gmplayer -rawvideo format=hm12:h=480:w=720:fps=29.97 -nocache -demuxer
> 26 /dev/video32 -framedrop -vo xv -monitoraspect 16:10

-rawvideo <options> means play a raw video file that has no container
format or metadata

format=hm12 specifies Conexant's Macroblock format of Y, U, and V
macroblocks prior to MPEG encoding. This format is an
intermediate product of the hardware MPEG encoding
process and the only raw video format ivtv can output.

h=480 digital screen height in lines. ivtv defaults to:
480 for NTSC and other 525 line/60Hz video
576 for most PAL systems and other 625 line/50Hz video

w=720 digital screen width in pixels including overscan (IIRC)
ivtv defaults to 720

fps=29.97 Frame rate:
29.97 for NTSC and other 525 line systems
25 for most PAL systems and other 625 line systems

-nocache means gmplayer will reneder video as it is received with no
buffering

-demuxer 26 The raw video demuxer.
See the output of gmplayer -demuxer help for names vs ID

-framedrop gmplayer will drop frames if it is falling behind in
rendering. If you have severe performance problems,
this will not help much with ivtv. You can lose frame
alignment and never get it back, if the ivtv driver has
to drop buffers for portions of a frame on the floor.
There is no way to resync the frame with the read()
interface except to stop and restart the capture.

-vo xv Use the XVideo extension for rendering video. If your
X server supports this for your graphics card (most do),
it performs better than using -vo x11


> cat /dev/video0 > /tmp/output_vid.mpg


> -------
>
> The above basically lets me record to mpg, while playing the video and
> audio on my PC, with only a slight lag (I'm not using a TV for the
> actual playback).
>
> The problem is that I don't actually understand most of those
> settings, but I need to adapt them from NTSC to PAL, to work with my
> 360.
>
> I think I need to have at least these changes:
> - v4lctl setnorm "PAL"
> - fps=25
> - w=576
>
> But that just shows up as a jumble in gmplayer, so there's probably
> more settings that need to be tweaked for PAL output.
>
> Any suggestions? Or do I need to ask this on gmplayer's mailing list?

1. Make sure you set the norm *after* switching inputs.
2. As Ian suggested: h=576 not w=.

Regards,
Andy


_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: gmplayer rawvideo settings for PAL [ In reply to ]
On Saturday 23 October 2010, David wrote:
> > I think you mean h=576.
> >
> >> But that just shows up as a jumble in gmplayer, so there's probably
> >> more settings that need to be tweaked for PAL output.
> >
> > If you did change the width instead of the height to 576 then the output
> > would be jumbled.
>
> Ah, I made a typo in the mail. Actually I did use that height, though
> I'm still getting a jumble.
>
> Though actually the picture is mostly recognizable, it just as some
> really bad "strobing" / tearing / distortion.
>
> However, I just checked the output video (from cat /dev/video0 >
> /tmp/output_vid.mpg), and that looks the same.
>
> So, I think my rawvideo options were mostly correct, and it's actually
> some v4lctl option that I need to set.
>
> I did just try using "NTSC" and "SECAM" values with "v4lctl setnorm",
> and they look even worse.
>
> Are there some other v4lctl options I should play with? (I'm a
> beginner with this).
>
> In case you're interested, here's a link to the mpg, so you can see
> the current distorted look
>
> http://wizzardx.isisview.org/uploads/misc/output_vid.mpg
>
> (produced by v4lctl setnorm "PAL", then catting /dev/video0 to the
> mpg, for a couple of seconds)

That looks like a format mismatch. Though the capture is pal resolution, the
captured video looks like ntsc.

When using v4l2-ctl simply setting the format to ntsc or pal should be
sufficient for the capture to work. I think the same applies to v4lctl.

Which version of the ivtv driver are you using? I've just done a quick test
here using the current release and it seems to work fine when changing capture
format.

--
Ian

_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: gmplayer rawvideo settings for PAL [ In reply to ]
On Sat, 2010-10-23 at 18:35 +0100, Ian Armstrong wrote:
> On Saturday 23 October 2010, David wrote:

> > So, I think my rawvideo options were mostly correct, and it's actually
> > some v4lctl option that I need to set.
> >
> > I did just try using "NTSC" and "SECAM" values with "v4lctl setnorm",
> > and they look even worse.
> >
> > Are there some other v4lctl options I should play with? (I'm a
> > beginner with this).
> >
> > In case you're interested, here's a link to the mpg, so you can see
> > the current distorted look
> >
> > http://wizzardx.isisview.org/uploads/misc/output_vid.mpg
> >
> > (produced by v4lctl setnorm "PAL", then catting /dev/video0 to the
> > mpg, for a couple of seconds)
>
> That looks like a format mismatch. Though the capture is pal resolution, the
> captured video looks like ntsc.
>
> When using v4l2-ctl simply setting the format to ntsc or pal should be
> sufficient for the capture to work. I think the same applies to v4lctl.

David,

Also make sure all captures on that card
(/dev/video0, /dev/video24, /dev/video32) are stopped when changing TV
norm, otherwise it may not take effect.

BTW
v4l2-ctl -d /dev/video0 --log-status

will show you the driver version and the card status (the cx25843 status
mostly applies to the tuner input).

v4l2-ctl -d /dev/video0 -L

will show you the settings of the user controls.

v4l2-ctl -d /dev/video0 -S

will show you what TV norm that the input is set to expect.

v4l2-ctl -d /dev/video0 -I

will show you the currently selected input.

Regards,
Andy



_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: gmplayer rawvideo settings for PAL [ In reply to ]
Thanks for all that information :-)

I didn't know about the v4l2-ctl command, so I've just installed the
'v4l-utils' Debian package (up until now I've been using the xawtv
package).

I did try NTSC mode before. The picture looks almost right, except
it's very grainy. I assumed it's meant to be PAL, because that's what
the 360's video settings mention.

Here's how it looks, after running 'v4l2-ctl -s ntsc', and then
catting /dev/video0 to a file:

http://wizzardx.isisview.org/uploads/misc/output_vid_2.mpg

It's basically the right picture, except very grainy, like the PVR
needs to be tuned slightly. Is there a setting that will help with
that?

Also, here's the output of the various commands, in case it helps. It
looks like my ivtv version is 1.4.1. I'm running Debian Sid:

----------------------
david@david:~$ v4l2-ctl -d /dev/video0 --log-status

Status Log:

[174848.413934] ivtv0: ================= START STATUS CARD #0
=================
[174848.413936] ivtv0: Version: 1.4.1 Card: Hauppauge WinTV PVR-150
[174848.466458] tveeprom 1-0050: Hauppauge model 26559, rev F060,
serial# 10642794
[174848.466460] tveeprom 1-0050: tuner model is LG S001D MK3 (idx
60, type 38)
[174848.466462] tveeprom 1-0050: TV standards PAL(B/G) PAL(I)
SECAM(L/L') PAL(D/D1/K) (eeprom 0x74)
[174848.466464] tveeprom 1-0050: audio processor is CX25843 (idx 37)
[174848.466466] tveeprom 1-0050: decoder processor is CX25843 (idx 30)
[174848.466467] tveeprom 1-0050: has radio
[174848.466472] ivtv0: GPIO status: DIR=0xdf00 OUT=0x26f3 IN=0x37f1
[174848.469675] cx25840 1-0044: Video signal: present
[174848.469677] cx25840 1-0044: Detected format: NTSC-4.43
[174848.469679] cx25840 1-0044: Specified standard: NTSC-M
[174848.469680] cx25840 1-0044: Specified video input: Composite 3
[174848.469682] cx25840 1-0044: Specified audioclock freq: 48000 Hz
[174848.477135] cx25840 1-0044: Detected audio mode: forced mode
[174848.477137] cx25840 1-0044: Detected audio standard: no
detected audio standard
[174848.477138] cx25840 1-0044: Audio muted: no
[174848.477140] cx25840 1-0044: Audio microcontroller: stopped
[174848.477141] cx25840 1-0044: Configured audio standard:
automatic detection
[174848.477143] cx25840 1-0044: Configured audio system: BTSC
[174848.477145] cx25840 1-0044: Specified audio input: External
[174848.477146] cx25840 1-0044: Preferred audio mode: stereo
[174848.477149] tda9887 1-0043: Data bytes: b=0x14 c=0x2e e=0x44
[174848.477151] tuner 1-0061: Tuner mode: analog TV
[174848.477153] tuner 1-0061: Frequency: 400.00 MHz
[174848.477154] tuner 1-0061: Standard: 0x0000b000
[174848.477156] wm8775 1-001b: Input: 2
[174848.477158] ivtv0: Video Input: Composite 1
[174848.477159] ivtv0: Audio Input: Line In 1
[174848.477160] ivtv0: Tuner: TV
[174848.477162] ivtv0: Stream: MPEG-2 Program Stream
[174848.477164] ivtv0: VBI Format: No VBI
[174848.477165] ivtv0: Video: 720x480, 30 fps
[174848.477167] ivtv0: Video: MPEG-2, 4x3, Variable Bitrate,
6000000, Peak 8000000
[174848.477169] ivtv0: Video: GOP Size 12, 2 B-Frames, GOP Closure
[174848.477172] ivtv0: Audio: 48 kHz, MPEG-1/2 Layer II, 224 kbps,
Stereo, No Emphasis, No CRC
[174848.477174] ivtv0: Spatial Filter: Manual, Luma 1D Horizontal,
Chroma 1D Horizontal, 0
[174848.477176] ivtv0: Temporal Filter: Manual, 8
[174848.477178] ivtv0: Median Filter: Off, Luma [0, 255], Chroma [0, 255]
[174848.477179] ivtv0: Status flags: 0x00200000
[174848.477181] ivtv0: Stream encoder MPG: status 0x0000, 0% of
4096 KiB (128 buffers) in use
[174848.477183] ivtv0: Stream encoder YUV: status 0x0000, 0% of
2048 KiB (64 buffers) in use
[174848.477185] ivtv0: Stream encoder VBI: status 0x0000, 0% of
1049 KiB (41 buffers) in use
[174848.477187] ivtv0: Stream encoder PCM: status 0x0000, 0% of 324
KiB (72 buffers) in use
[174848.477189] ivtv0: Read MPG/VBI: 1128384/0 bytes
[174848.477190] ivtv0: ================== END STATUS CARD #0
==================

david@david:~$ v4l2-ctl -d /dev/video0 -L

User Controls

brightness (int) : min=0 max=255 step=1
default=128 value=128 flags=slider
contrast (int) : min=0 max=127 step=1
default=64 value=64 flags=slider
saturation (int) : min=0 max=127 step=1
default=64 value=64 flags=slider
hue (int) : min=-128 max=127 step=1
default=0 value=0 flags=slider
volume (int) : min=0 max=65535 step=655
default=60928 value=60928 flags=slider
balance (int) : min=0 max=65535 step=655
default=32768 value=32768 flags=slider
bass (int) : min=0 max=65535 step=655
default=32768 value=32768 flags=slider
treble (int) : min=0 max=65535 step=655
default=32768 value=32768 flags=slider
mute (bool) : default=0 value=0

MPEG Encoder Controls

stream_type (menu) : min=0 max=5 default=0 value=0
flags=update
0: MPEG-2 Program Stream
2: MPEG-1 System Stream
3: MPEG-2 DVD-compatible Stream
4: MPEG-1 VCD-compatible Stream
5: MPEG-2 SVCD-compatible Stream
stream_vbi_format (menu) : min=0 max=1 default=0 value=0
0: No VBI
1: Private packet, IVTV format
audio_sampling_frequency (menu) : min=0 max=2 default=1 value=1
0: 44.1 kHz
1: 48 kHz
2: 32 kHz
audio_encoding (menu) : min=1 max=1 default=1 value=1
flags=update
1: MPEG-1/2 Layer II
audio_layer_ii_bitrate (menu) : min=9 max=13 default=10 value=10
9: 192 kbps
10: 224 kbps
11: 256 kbps
12: 320 kbps
13: 384 kbps
audio_stereo_mode (menu) : min=0 max=3 default=0 value=0
flags=update
0: Stereo
1: Joint Stereo
2: Dual
3: Mono
audio_stereo_mode_extension (menu) : min=0 max=3 default=0 value=0
flags=inactive
0: Bound 4
1: Bound 8
2: Bound 12
3: Bound 16
audio_emphasis (menu) : min=0 max=2 default=0 value=0
0: No Emphasis
1: 50/15 us
2: CCITT J17
audio_crc (menu) : min=0 max=1 default=0 value=0
0: No CRC
1: 16-bit CRC
audio_mute (bool) : default=0 value=0
video_encoding (menu) : min=0 max=1 default=1 value=1
flags=read-only
0: MPEG-1
1: MPEG-2
video_aspect (menu) : min=0 max=3 default=1 value=1
0: 1x1
1: 4x3
2: 16x9
3: 2.21x1
video_b_frames (int) : min=0 max=33 step=1 default=2
value=2 flags=update
video_gop_size (int) : min=1 max=34 step=1 default=15 value=12
video_gop_closure (bool) : default=1 value=1
video_bitrate_mode (menu) : min=0 max=1 default=0 value=0
flags=update
0: Variable Bitrate
1: Constant Bitrate
video_bitrate (int) : min=0 max=27000000 step=1
default=6000000 value=6000000
video_peak_bitrate (int) : min=0 max=27000000 step=1
default=8000000 value=8000000
video_temporal_decimation (int) : min=0 max=255 step=1 default=0 value=0
video_mute (bool) : default=0 value=0
video_mute_yuv (int) : min=0 max=16777215 step=1
default=32896 value=32896
spatial_filter_mode (menu) : min=0 max=1 default=0 value=0
flags=update
0: Manual
1: Auto
spatial_filter (int) : min=0 max=15 step=1 default=0
value=0 flags=slider
spatial_luma_filter_type (menu) : min=0 max=4 default=1 value=1
0: Off
1: 1D Horizontal
2: 1D Vertical
3: 2D H/V Separable
4: 2D Symmetric non-separable
spatial_chroma_filter_type (menu) : min=0 max=1 default=1 value=1
0: Off
1: 1D Horizontal
temporal_filter_mode (menu) : min=0 max=1 default=0 value=0
flags=update
0: Manual
1: Auto
temporal_filter (int) : min=0 max=31 step=1 default=8
value=8 flags=slider
median_filter_type (menu) : min=0 max=4 default=0 value=0
flags=update
0: Off
1: Horizontal
2: Vertical
3: Horizontal/Vertical
4: Diagonal
median_luma_filter_minimum (int) : min=0 max=255 step=1
default=0 value=0 flags=inactive, slider
median_luma_filter_maximum (int) : min=0 max=255 step=1
default=255 value=255 flags=inactive, slider
median_chroma_filter_minimum (int) : min=0 max=255 step=1
default=0 value=0 flags=inactive, slider
median_chroma_filter_maximum (int) : min=0 max=255 step=1
default=255 value=255 flags=inactive, slider
insert_navigation_packets (bool) : default=0 value=0

david@david:~$ v4l2-ctl -d /dev/video0 -S
Video Standard = 0x0000b000
NTSC-M/M-JP/M-KR

david@david:~$ v4l2-ctl -d /dev/video0 -I
Video input : 2 (Composite 1: ok)
----------------------

Any further suggestions?

Thanks,

David.

_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: gmplayer rawvideo settings for PAL [ In reply to ]
On Sunday 24 October 2010, David wrote:
> Thanks for all that information :-)
>
> I didn't know about the v4l2-ctl command, so I've just installed the
> 'v4l-utils' Debian package (up until now I've been using the xawtv
> package).
>
> I did try NTSC mode before. The picture looks almost right, except
> it's very grainy. I assumed it's meant to be PAL, because that's what
> the 360's video settings mention.
>
> Here's how it looks, after running 'v4l2-ctl -s ntsc', and then
> catting /dev/video0 to a file:
>
> http://wizzardx.isisview.org/uploads/misc/output_vid_2.mpg
>
> It's basically the right picture, except very grainy, like the PVR
> needs to be tuned slightly. Is there a setting that will help with
> that?

Just a guess, but I suspect the source may be PAL-60. Try 'v4l2-ctl -s pal-60'

--
Ian

_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: gmplayer rawvideo settings for PAL [ In reply to ]
>
> Just a guess, but I suspect the source may be PAL-60. Try 'v4l2-ctl -s pal-60'
>

Thanks, that works!

And just an extra note, it looks like for some reason, to decode the
raw stream (for minimal gameplay lag) off the PVR card, I need to
still use the NTSC line, despite the source being PAL-60:

gmplayer -rawvideo format=hm12:h=480:w=720:fps=29.97 -nocache -demuxer
26 /dev/video32 -framedrop -vo xv -monitoraspect 16:10 || true

I wonder what the reason for that is?

Anyway, thanks for the help :-). I'll now be able to make my 360 gameplay vids.

Also, going off topic a bit, but I want to get a HD tv capture device
a bit later for gameplay vids, ie this one:

http://www.hauppauge.com/site/products/data_hdpvr.html

The main info I can find for Linux use of that device is with mythtv:

http://www.mythtv.org/wiki/Hauppauge_HD-PVR

Is that device fairly straightforwards to get up and running on Linux?

Ideally I'd like to use a similar workflow to what I'm doing now (cat
video device to file for later re-encoding (looks like some unusual
".ts" format, hope I can find Linux tools for it), while playing
either through gmplayer and aplay, or through an actual HD TV). Don't
really want to dual boot to Windows if I can avoid it.

Thanks,

David.

_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users