Recherche avancée

Médias (2)

Mot : - Tags -/plugins

Autres articles (27)

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

Sur d’autres sites (2606)

  • FFMPEG - rewarp MPEGDash to MP4 changes audio bitrate mode

    30 juin 2022, par Matthieu Ducorps

    I'm rewrapping some MPEGDash to MP4 wrapper and some files are outputed with variable audio bitrate where others with constant bitrate,and both sources looks exactly the same.

    


    For reference :

    


    I'm using FFMPEG 5.0 for the rewrapping

    


    ffmpeg version 5.0-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
    built with gcc 11.2.0 (Rev5, Built by MSYS2 project)
    configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
    libavutil      57. 17.100 / 57. 17.100
    libavcodec     59. 18.100 / 59. 18.100
    libavformat    59. 16.100 / 59. 16.100
    libavdevice    59.  4.100 / 59.  4.100
    libavfilter     8. 24.100 /  8. 24.100
    libswscale      6.  4.100 /  6.  4.100
    libswresample   4.  3.100 /  4.  3.100
    libpostproc    56.  3.100 / 56.  3.100


    


    And MediaInfo 22.09 to check the medias.

    


    MediaInfoVersion

    


    I'm using this command to rewrap the media :

    


    ffmpeg.exe -y -i MPEGDash.mpd -map 0:v -map 0:a -c copy OutFile.mp4


    


    This source MPEGDASH with constant audio bitrate

    


    General
Complete name                            : \\Constant\PROXY\A0002_30sec\MPEGDash_A0002_30sec.mpd
Format                                   : DASH MPD
File size                                : 4.14 MiB
Duration                                 : 30 s 80 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 154 kb/s

Video
ID                                       : 0-1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Format settings, GOP                     : M=3, N=30
Muxing mode                              : dash
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 30 s 30 ms
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Width                                    : 640 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.093
Stream size                              : 2.28 MiB (55%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:20:16
Tagged date                              : UTC 2022-06-30 08:20:16
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Source                                   : V0_360p_640000/V0_360p_640000_init.mp4
Codec configuration box                  : avcC

Audio #1
ID                                       : 160-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:20:16
Tagged date                              : UTC 2022-06-30 08:20:16
Source                                   : A0_48000_128000/A0_48000_128000_init.mp4

Audio #2
ID                                       : 161-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:20:16
Tagged date                              : UTC 2022-06-30 08:20:16
Source                                   : A1_48000_128000/A1_48000_128000_init.mp4

Audio #3
ID                                       : 162-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:20:16
Tagged date                              : UTC 2022-06-30 08:20:16
Source                                   : A2_48000_128000/A2_48000_128000_init.mp4

Audio #4
ID                                       : 163-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:20:16
Tagged date                              : UTC 2022-06-30 08:20:16
Source                                   : A3_48000_128000/A3_48000_128000_init.mp4


    


    Has the expected output with constant audio bitrate on the MP4

    


    General
Complete name                            : \\Constant\PROXY\A0002_30sec\A0002_30sec.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 4.13 MiB
Duration                                 : 30 s 96 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 152 kb/s
Movie name                               : MPEGDash_A0002_30sec.mpd
Writing application                      : Lavf59.16.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Format settings, GOP                     : M=3, N=30
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 30 s 96 ms
Source duration                          : 29 s 997 ms
Bit rate mode                            : Constant
Bit rate                                 : 590 kb/s
Nominal bit rate                         : 640 kb/s
Maximum bit rate                         : 636 kb/s
Width                                    : 640 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.085
Stream size                              : 2.12 MiB (51%)
Source stream size                       : 2.28 MiB (55%)
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
mdhd_Duration                            : 30030
Codec configuration box                  : avcC

Audio #1
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1

Audio #2
ID                                       : 3
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 2

Audio #3
ID                                       : 4
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 3

Audio #4
ID                                       : 5
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 4


    


    But this source MPEGDASH which has the same characteristics :

    


    General
Complete name                            : \\Variable\PROXY\A0005_30sec\MPEGDash_A0005_30sec.mpd
Format                                   : DASH MPD
File size                                : 4.15 MiB
Duration                                 : 30 s 80 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 157 kb/s

Video
ID                                       : 0-1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Format settings, GOP                     : M=3, N=30
Muxing mode                              : dash
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 30 s 30 ms
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Width                                    : 640 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.093
Stream size                              : 2.29 MiB (55%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:24:03
Tagged date                              : UTC 2022-06-30 08:24:03
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Source                                   : V0_360p_640000/V0_360p_640000_init.mp4
Codec configuration box                  : avcC

Audio #1
ID                                       : 160-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 461 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:24:03
Tagged date                              : UTC 2022-06-30 08:24:03
Source                                   : A0_48000_128000/A0_48000_128000_init.mp4

Audio #2
ID                                       : 161-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:24:03
Tagged date                              : UTC 2022-06-30 08:24:03
Source                                   : A1_48000_128000/A1_48000_128000_init.mp4

Audio #3
ID                                       : 162-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:24:03
Tagged date                              : UTC 2022-06-30 08:24:03
Source                                   : A2_48000_128000/A2_48000_128000_init.mp4

Audio #4
ID                                       : 163-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:24:03
Tagged date                              : UTC 2022-06-30 08:24:03
Source                                   : A3_48000_128000/A3_48000_128000_init.mp4


    


    Has this output where the MP4 have the first audio with variable bitrate

    


    General
Complete name                            : \\Variable\PROXY\A0005_30sec\A0005_30sec.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 4.14 MiB
Duration                                 : 30 s 96 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 155 kb/s
Movie name                               : MPEGDash_A0005_30sec.mpd
Writing application                      : Lavf59.16.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Format settings, GOP                     : M=3, N=30
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 30 s 96 ms
Source duration                          : 29 s 997 ms
Bit rate mode                            : Constant
Bit rate                                 : 593 kb/s
Nominal bit rate                         : 640 kb/s
Maximum bit rate                         : 640 kb/s
Width                                    : 640 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.086
Stream size                              : 2.13 MiB (51%)
Source stream size                       : 2.29 MiB (55%)
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
mdhd_Duration                            : 30030
Codec configuration box                  : avcC

Audio #1
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Variable
Bit rate                                 : 126 kb/s
Maximum bit rate                         : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 461 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1

Audio #2
ID                                       : 3
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 2

Audio #3
ID                                       : 4
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 3

Audio #4
ID                                       : 5
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 4


    


    Maybe I'm missing something but,I don't see what.

    


  • Python : mp3 to wave.open(f,'r') through ffmpeg pipe

    7 avril 2015, par user2754098

    I’m trying to decode mp3 to wav using ffmpeg :

    import alsaaudio
    import wave
    from subprocess import Popen, PIPE

    with open('filename.mp3', 'rb') as infile:
       p=Popen(['ffmpeg', '-i', '-', '-f', 'wav', '-'], stdin=infile, stdout=PIPE)
       ...

    Next i want redirect data from p.stdout.read() to wave.open(file, r) to use readframes(n) and other methods. But i cannot because ’file’ in wave.open(file,’r’) can be only name of file or an open file pointer.

       ...
       file = wave.open(p.stdout.read(),'r')
       card='default'
       device=alsaaudio.PCM(card=card)
       device.setchannels(file.getnchannels())
       device.setrate(file.getframerate())
       device.setformat(alsaaudio.PCM_FORMAT_S16_LE)
       device.setsetperiodsize(320)
       data = file.readframes(320)
       while data:
           device.write(data)
           data = file.readframes(320)

    I got :

    TypeError: file() argument 1 must be encoded string without NULL bytes, not str

    So is it possible to handle data from p.stdout.read() by wave.open() ?
    Making temporary .wav file isn’t solution.

    Sorry for my english.
    Thanks.

  • Python : mp3 to alsaaudio through ffmpeg pipe and wave.open(f,'r')

    16 avril 2015, par user2754098

    I’m trying to decode mp3 to wav using ffmpeg :

    import alsaaudio
    import wave
    from subprocess import Popen, PIPE

    with open('filename.mp3', 'rb') as infile:
       p=Popen(['ffmpeg', '-i', '-', '-f', 'wav', '-'], stdin=infile, stdout=PIPE)
       ...

    Next i want redirect data from p.stdout.read() to wave.open(file, r) to use readframes(n) and other methods. But i cannot because ’file’ in wave.open(file,’r’) can be only name of file or an open file pointer.

       ...
       file = wave.open(p.stdout.read(),'r')
       card='default'
       device=alsaaudio.PCM(card=card)
       device.setchannels(file.getnchannels())
       device.setrate(file.getframerate())
       device.setformat(alsaaudio.PCM_FORMAT_S16_LE)
       device.setsetperiodsize(320)
       data = file.readframes(320)
       while data:
           device.write(data)
           data = file.readframes(320)

    I got :

    TypeError: file() argument 1 must be encoded string without NULL bytes, not str

    So is it possible to handle data from p.stdout.read() by wave.open() ?
    Making temporary .wav file isn’t solution.

    Sorry for my english.
    Thanks.

    UPDATE

    Thanks to PM 2Ring for hit about io.BytesIO.

    However resulting code does not work.

    import alsaaudio
    import wave
    from subprocess import Popen, PIPE

    with open('sometrack.mp3', 'rb') as infile:
           p=Popen(['ffmpeg', '-i', '-', '-f','wav', '-'], stdin=infile , stdout=PIPE , stderr=PIPE)
           fobj = io.BytesIO(p.stdout.read())
    fwave = wave.open(fobj, 'rb')

    Trace :

    File "./script.py", line x, in <module>
     fwave = wave.open(fobj, 'rb')
    File "/usr/lib/python2.7/wave.py", line x, in open
     return Wave_read(f)
    File "/usr/lib/python2.7/wave.py", line x, in __init__
     self.initfp(f)
    File "/usr/lib/python2.7/wave.py", line x, in initfp
     raise Error, 'not a WAVE file'
    wave.Error: not a WAVE file
    </module>

    From /usr/lib/python2.7/wave.py :

    ...
    self._file = Chunk(file, bigendian = 0)
    if self._file.getname() != 'RIFF':
       raise Error, 'file does not start with RIFF id'
    if self._file.read(4) != 'WAVE':
       raise Error, 'not a WAVE file'
    ...

    Checking has been failed due to ’bad’ self._file object.

    Inside /usr/lib/python2.7/chunk.py i have found a source of problem :

    ...
    try:
       self.chunksize = struct.unpack(strflag+'L', file.read(4))[0]
    except struct.error:
       raise EOFError
    ...

    Because struct.unpack(strflag+’L’, file.read(4))[0] returns 0.
    But this function works correct.

    As specified here :

    "5-8 bytes - File size(integer)
    Size of the overall file - 8 bytes, in bytes (32-bit integer). Typically, you’d fill this in after creation."
    That’s why my script doesn’t work. wave.open and other functions cannot handle my file object because self.chunksize = 0. Looks like ffmpeg cannot insert File size when using PIPE.

    SOLUTION

    It’s simple.
    I’ve changed init function of Chunk class :

    After :

    ...
    try:
       self.chunksize = struct.unpack(strflag+'L', file.read(4))[0]
    except struct.error:
       raise EOFError
    ...

    Before :

    ...
    try:
       self.chunksize = struct.unpack(strflag+'L', file.read(4))[0]
       currtell = file.tell()
       if self.chunksize == 0:
           file.seek(0)
           file.read(currtell)
           self.chunksize = len(file.read())-4
           file.seek(0)
           file.read(currtell)
    except struct.error:
       raise EOFError
    ...

    Of course editing of original module is bad idia. So I’ve create custom forks for 2 classes Chunk and Wave_read.

    Working but unstable full code you can find here.

    Sorry for my awful english.

    Thanks.