Changes

Plextor ConvertX PX-M402U

8,393 bytes added, 22:22, 25 March 2021
/* testing audio input */
The following lines were added (+) and removed (-):
The device was recognized in [[Mythubuntu]] immediately upon connection.  The output of lsusb shows the device as:The device was recognized in [[Mythbuntu]] immediately upon connection.  The output of lsusb shows the device as:The audio device is going to have a name like: "hw:3,0" It will likely be a second audio device since the first is the system soundcard.  * hw:0,0 - The system sound device / [[ALSA]] device* hw:3,0 - Audio from Plextor ConvertXFinding the ConvertX, type: cat /proc/asound/cardsOutput Example: 0 [SB            ]: HDA-Intel - HDA ATI SB                      HDA ATI SB at 0xfe5f4000 irq 16 1 [HDMI          ]: HDA-Intel - HDA ATI HDMI                      HDA ATI HDMI at 0xfe7e8000 irq 19 2 [pcsp          ]: PC-Speaker - pcsp                      Internal PC-Speaker at port 0x61 3 [PXM402        ]: go7007 - Plextor PX-M402                      Plextor PX-M402ref: http://www.alsa-project.org/main/index.php/Asoundrc=== Testing with VLC (Video LAN Player) ===Verified working audio and video using VLC Player 2.1.4Assuming your capture device is /dev/video0 and ALSA ID is hw:3,0 then do the following:# Open VLC # On the menubar: Media -> Open Capture Device (or press CNTL-C)# In this Open Media dialog click the "Capture Device" tab.# Use these settings:##Capture mode: Video Camera##Device Selection###Video device name: /dev/video0###Audio device name: hw:3,0# Click the Play button at the bottom of the dialogThis is creating the playlist v4l2:///dev/video0v4l2 is Video4Linux version 2 video capture framework for linux.  [[Video4Linux2]] drivers have to setup supporting ICs todo audio/video muxing/encoding/decoding.  To open the capture device with video and audio from the command line: vlc v4l2:///dev/video0 :input-slave="alsa://hw:3,0" Test with VLC playing video from a connected composite DVD player.  VLC reports the following:Video*Codec: MPEG-4 Video (mp4v)*Resolution: 720x480*Frames: 29.97*Decode: Planar 4:2:0 YUVAudio*Codec: PCM S16 LE(s16l)*Channels: Stereo*Sample rate: 48000 Hz 16 bit=== Testing with mplayer ===Successful.  Audio + Video after disable PulseAudio's control of the device.  Skip to end to see solution.Problem:  Video in [[mplayer]] but no audioThis produces a picture but no audio: mplayer tv:// -tv driver=v4l2:norm=NTSC:input=0:amode=1:width=720:height=480:outfmt=yv12:device=/dev/video0Now to add audio: mplayer tv:// -tv driver=v4l2:norm=NTSC:input=0:amode=1:alsa=1:adevice=hw.3,0:audiorate=96000:forceaudio:width=720:height=480:outfmt=yv12:device=/dev/video0:immediatemode=0Some of the parameters explained:*alsa=1 (use alsa)*adevice=hw.3,0 (use direct hardware access with device 0 of card 3 which is the Plextor ConvertX on my system)*audiorate=32000 (audio sample rate)*amode=1 (stereo)*input=0 (0=composite input, 1=svideo input)*norm=NTSC or normid=4  (see supported norms: 0 = PAL, 4 = NTSC)So that should work, right?  It didn't at first.  See the (partial) [[mplayer]] error output: [...] Error opening audio: Device or resource busy v4l2: ioctl set mute failed: Invalid argument v4l2: 0 frames successfully processed, 0 frames dropped. Exiting... (End of file)The problem was caused by PulseAudio tieing up the resource (ConvertX audio) so it appeared busy to [[mplayer]].  I don't know why this bothers mplayer and not vlc.  vlc doesn't seem to care.  Anyway, the solution:"''[http://linuxtv.org/wiki/index.php/OTG102#Problems_with_audio If mplayer etc. reports that the audio device is busy] "error opening audio: Device or resource busy" and you are using pulseaudio, disable pulseaudio's control of the device, eg in pavucontrol (Pulse Audio Volume Control) under configuration, set the Cx231xx Audio device to be off. This will allow other programs to access the resource through the alsa device.'' "That absolutely solved the problem with mplayer.Under the "Configuration" tab in Pulse Audio Control you see "ConvertX M402U A/V Capture" and a drop-down box next to the label "Profile."  That drop down box has the following two options:* Analog Stereo Input* OffBy changing it from "Analog Stereo Input" to "Off" you allow mplayer to have access to alsa.  You will notice that if you click on the Pulse Audio Control tab "Input Devices" that the #2 Input Device listed "ConvertX M402U A/V Analog Stereo" is not visible.  That area of the interface is empty.  If you go back and change the drop down box in the "Configuration" tab to "Analog Stereo Input" then the #2 Input Device listed "ConvertX M402U A/V Analog Stereo" under the "Input Devices" tab will become visible again.=== Sometimes the USB port goes KaBlam ===While testing you might find the USB port stops.  If you do this: cat /dev/video0and you get nothing, knowing that your video source is connected and active, you might need tounplug the USB cable and plug it back in again after a few seconds to reset the port.If reaching behind the computer to unplug the USB cable is bothersome you can try this snazzy little C program to reset the USB port:* [[usbreset.c]] - specify the BUS and DEVICE number to reset the USB port.Note: as an alternative to /dev/video0 (which you don't want to try from a remote shell) you can strip the non-ascii characters for a safer test of the device. tr -cd '\11\12\15\40-\176' < /dev/video0=== module-loopback hack ===We made it so there was audio and video using VLC.  However, many other apps have trouble. [[mplayer]] command line parameters are more tricky than vlc.  It is possible to bind the input device from the Plextor ConvertX to the Alsa stereo output.  1. Install pulseaudio control: pavucontrol apt-get install pavucontrol2. Start your a/v source.  Open KMPlayer and direct it to play from file: /dev/video0  or try "Dragon Player".3. Open pavucontrol and notice under the "Input Devices" tab there will be two separate areas.  [[File:pulseaudio-loopback01.jpg]]* Built-in Audio Analog Stereo* ConvertX M402U A/V Capture Analog StereoIf your connected device and the ConvertX are both work properly you will see activity on the level indicator bar (which is blue in the illustration) for #2.  But you don't hear anything.  You can bind (might not be the correct term for it) the sound card to the ConvertX audio input using module-loopback. pacmd load-module module-loopback latency_msec=5Now you should hear out the speakers what is showing as indicator bar activity on "ConvertX M402U A/V Capture Analog Stereo"This is an ugly hack.  Why?  Because you just combined everything so whatever else is playing through the card will get mixed and you will hear it or it will be captured if you are encoding.You can remove the module-loopback mixing by doing: pacmd unload-module module-loopbacksource: [http://www.linuxquestions.org/questions/linux-software-2/alsa-and-pulseaudio-recording-multiple-input-devices-877614/ jthill on linuxquestions.org]It would be better to specify which interfaces to mix specifically rather than just mixing them all.  pactl load-module module-loopback source="alsa_input.usb-PLEXTOR_Plextor_ConvertX_M402U-00-PXM402.analog-stereo" sink="alsa_output.pci-0000_00_08.0.analog-stereo"I couldn't get this to work.  When I do I will come back here and correct the error.  moving on...Q: How do I know what to specify for the source, what is the exact correct text string?A: I found it by using "pacmd list-sources".  There is a lot of information, it would help to narrow it down: pacmd list-sources |grep M402UAnother cool way to narrow down the information for any capture device and to show inputs and outputs... pacmd list-sources | sed -nr '/^ |\tname:/H;${g;s/\n\t/\t/g;s/\n//p}'Ugly Hack Warning: ''There is latency when using the "hard wire" or "binding" hack.  You might notice that sound lags behind the video depending on your hardware and system processing power.  It is better to use the method described in the VLC section where you can tell the software which input device to use for sound.See also:* [https://wiki.archlinux.org/index.php/PulseAudio/Examples PulseAudio/Examples]* [http://www.freedesktop.org/wiki/Software/PulseAudio/FAQ/#index39h3 freedesktop.org PulseAudio FAQ] - a guide that was never very verbose and notably incomplete.With the capture device working having both audio and video using [[mplayer]] then MythTV should be able to fully use the capture device.  It is just a matter of a proper configuration of MythTV back-end settings.<big><big>coming soon...</big></big>{{:Template:Sparse Entry}}
Bureaucrat, administrator
16,192
edits