about audio problem while using gstreamer to play mp3 files

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

about audio problem while using gstreamer to play mp3 files

Jump to solution
4,343 Views
liangyu
Contributor III

Hi All,

     Recently,I wanna play mp3 file by using gstreamer.But when my board had many audio cards,the problem occurred.

     Board: i.MX6Q SDB

     #arecord -l

     **** List of CAPTURE Hardware Devices ****
     card 0: wm8962audio [wm8962-audio], device 0: HiFi wm8962-0 []
       Subdevices: 1/1
       Subdevice #0: subdevice #0

  

     #aplay -l

     **** List of PLAYBACK Hardware Devices ****
     card 0: wm8962audio [wm8962-audio], device 0: HiFi wm8962-0 []
       Subdevices: 1/1
       Subdevice #0: subdevice #0
     card 1: imxhdmisoc [imx-hdmi-soc], device 0: IMX HDMI TX mxc-hdmi-soc-0 []
       Subdevices: 1/1
       Subdevice #0: subdevice #0

     #gst-launch filesrc location=/home/ILOVEIT.mp3 ! mad ! alsasink 

    It works very well.

  But I insert a usb mic before reboot,

     #arecord -l

     **** List of CAPTURE Hardware Devices ****
     card 0: U0x46d0x825 [USB Device 0x46d:0x825], device 0: USB Audio [USB Audio]
       Subdevices: 1/1
       Subdevice #0: subdevice #0
     card 1: wm8962audio [wm8962-audio], device 0: HiFi wm8962-0 []
       Subdevices: 1/1
       Subdevice #0: subdevice #0

   

    #aplay -l

     **** List of PLAYBACK Hardware Devices ****
     card 1: wm8962audio [wm8962-audio], device 0: HiFi wm8962-0 []
       Subdevices: 1/1
       Subdevice #0: subdevice #0
     card 2: imxhdmisoc [imx-hdmi-soc], device 0: IMX HDMI TX mxc-hdmi-soc-0 []
       Subdevices: 1/1
       Subdevice #0: subdevice 0

     #gst-launch filesrc location=/home/ILOVEIT.mp3 ! mad ! alsasink device="hw:1,0"

     it is not working.The output print follows as:

     Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstAlsaSink:alsasink0: Could not get/set settings from/on resource.
Additional debug info:
gstalsasink.c(477): set_hwparams (): /GstPipeline:pipeline0/GstAlsaSink:alsasink0:
Sample format not available for playback: Invalid argument
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

But I use playbin2 to run it and add this setting,it works

    #gst-launch playbin2 uri=file:///home/ILOVEIT.mp3 audio-sink="alsasink device="hw:1,0""

I don't know what I miss? Can  Anybody tell me why? How to solve "Could not get/set settings from/on resource." problem?

Labels (2)
0 Kudos
1 Solution
1,751 Views
LeonardoSandova
Specialist I

Hi Lian,

I am not an audio expert but there are two ways to figure out what elements are being instantiated in playbin2 (so you can find the missing ones on the pipeline you are manually creating), check this link

https://community.freescale.com/docs/DOC-93451

Try to use the same elements as playbin2 in your manual-pipeline.

Leo

View solution in original post

0 Kudos
2 Replies
1,752 Views
LeonardoSandova
Specialist I

Hi Lian,

I am not an audio expert but there are two ways to figure out what elements are being instantiated in playbin2 (so you can find the missing ones on the pipeline you are manually creating), check this link

https://community.freescale.com/docs/DOC-93451

Try to use the same elements as playbin2 in your manual-pipeline.

Leo

0 Kudos
1,751 Views
liangyu
Contributor III

I get the resolution, I miss the audioconvert element before alsasink.Thx

0 Kudos