Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques ffmpeg multiplex pcm audio

  • ffmpeg multiplex pcm audio

    Posted by Andre Saegerman on October 31, 2010 at 11:15 am

    Hi,

    I try to multiplex a mpeg2 video with a wav-audio file.
    The command I use is
    ffmpeg.exe -y -i “video.mpg” -f wav -i “audio.wav” -vcodec copy -acodec pcm_s16be “video-mux.mpg”

    The multiplex seems to succeed, I can play it with MS Media player, however with a lot of other players (incl Nero and VLC) the sound doesn’t play. When i use spumux to multiplex subtitles, I get error messages:
    WARN: Incorrect pack header
    WARN: Unknown header 01 bb 00 0c
    INFO: Skipped 42994 bytes of garbage
    ….
    So I assume that multiplex is wrong.

    Can anybody help me please?

    Douglas Jotblad replied 15 years, 9 months ago 3 Members · 7 Replies
  • 7 Replies
  • Michael Rampe

    November 2, 2010 at 9:07 am

    ****please post more information****

    A header read on the output (ffmpeg -i video-mux.mpg) as well as the relevant stream mapping info from the encode run would be helpful.

    Michael

  • Andre Saegerman

    November 2, 2010 at 7:34 pm

    Hi Michael,
    thx for your reply.

    the captured info of the encoding command:

    X:\testen\video\Witse>call "C:\Program Files\ffmpeg-0.5\ffmpeg.exe" -y -t 1 -v 8 -i "X:\testen\video\Witse\witse1_1.mpg" -f wav -i "X:\testen\video\Witse\witse1_1_2.wav" -vcodec copy -acodec pcm_s16be "X:\testen\video\Witse\witse1_1_mux.mpg"
    FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
    configuration: --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-avfilter-lavf --enable-pthreads --enable-avisynth --enable-libfaac -
    -enable-libfaad --enable-libmp3lame --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libxvid --enable-libx264 --enable-memalign-hack
    libavutil 49.15. 0 / 49.15. 0
    libavcodec 52.20. 0 / 52.20. 0
    libavformat 52.31. 0 / 52.31. 0
    libavdevice 52. 1. 0 / 52. 1. 0
    libavfilter 0. 4. 0 / 0. 4. 0
    libswscale 0. 7. 1 / 0. 7. 1
    libpostproc 51. 2. 0 / 51. 2. 0
    built on Mar 16 2009 16:09:18, gcc: 4.2.4 [Sherpya]

    Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1)
    -> 25.00 (25/1)
    Input #0, mpegvideo, from 'X:\testen\video\Witse\witse1_1.mpg':
    Duration: 00:00:08.70, bitrate: 7455 kb/s
    Stream #0.0, 1/1200000: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 1
    6:9], 1/50, 7456 kb/s, 25 tbr, 1200k tbn, 50 tbc
    Input #1, wav, from 'X:\testen\video\Witse\witse1_1_2.wav':
    Duration: 00:00:08.55, bitrate: 1536 kb/s
    Stream #1.0, 1/48000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    Output #0, mpeg, to 'X:\testen\video\Witse\witse1_1_mux.mpg':
    Stream #0.0, 1/90000: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:
    9], 1/25, q=2-31, 7456 kb/s, 90k tbn, 25 tbc
    Stream #0.1, 1/90000: Audio: pcm_s16be, 48000 Hz, stereo, s16, 1536 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #1.0 -> #0.1
    Press [q] to stop encoding
    [mpeg @ 0x1751050]buffer underflow i=1 bufi=4064 size=4096
    Last message repeated 67 times
    [mpeg @ 0x1751050]packet too large, ignoring buffer limits to mux it
    [mpeg @ 0x1751050]buffer underflow i=1 bufi=4064 size=4096
    [mpeg @ 0x1751050]buffer underflow i=1 bufi=4032 size=4096
    [mpeg @ 0x1751050]packet too large, ignoring buffer limits to mux it
    [mpeg @ 0x1751050]buffer underflow i=1 bufi=2120 size=4096
    ... (deleted a lot of identic lines
    [mpeg @ 0x1751050]buffer underflow i=1 bufi=2076 size=4096
    [mpeg @ 0x1751050]packet too large, ignoring buffer limits to mux it
    [mpeg @ 0x1751050]buffer underflow i=1 bufi=2076 size=4096
    frame= 25 fps= 0 q=-1.0 Lsize= 1172kB time=1.00 bitrate=9601.0kbits/s dup=
    0 drop=0
    video:977kB audio:188kB global headers:0kB muxing overhead 0.587873%

    ————————————————————–
    and header on the output:
    X:\testen\video\Witse>ffmpeg -i witse1_1_mux.mpg
    FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
    configuration: --enable-gpl --enable-postproc --enable-swscale --enable-avfilt
    er --enable-avfilter-lavf --enable-pthreads --enable-avisynth --enable-libfaac -
    -enable-libfaad --enable-libmp3lame --enable-libspeex --enable-libtheora --enabl
    e-libvorbis --enable-libxvid --enable-libx264 --enable-memalign-hack
    libavutil 49.15. 0 / 49.15. 0
    libavcodec 52.20. 0 / 52.20. 0
    libavformat 52.31. 0 / 52.31. 0
    libavdevice 52. 1. 0 / 52. 1. 0
    libavfilter 0. 4. 0 / 0. 4. 0
    libswscale 0. 7. 1 / 0. 7. 1
    libpostproc 51. 2. 0 / 51. 2. 0
    built on Mar 16 2009 16:09:18, gcc: 4.2.4 [Sherpya]
    Input #0, mpeg, from 'witse1_1_mux.mpg':
    Duration: 00:00:00.98, start: 0.500000, bitrate: 9783 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9]
    , 7456 kb/s, 50 tbr, 90k tbn, 50 tbc
    Stream #0.1[0xa0]: Audio: pcm_s16be, 48000 Hz, stereo, s16, 1536 kb/s
    At least one output file must be specified

    The encoded file plays with no problem on Windows Media Player (perfect quality), video OK but no sound on VLC MediaPlayer, Nero ShowTime,

    Output from Mediainfo 0.7.15:
    General
    Complete name : X:\testen\video\Witse\witse1_1_mux.mpg
    Format : MPEG-PS
    File size : 1.14 MiB
    Duration : 880ms
    Overall bit rate : 10.9 Mbps

    Video
    ID : 224 (0xE0)
    Format : MPEG Video
    Format version : Version 2
    Format profile : Main@Main
    Format settings, Matrix : Default
    Duration : 880ms
    Bit rate mode : Constant
    Bit rate : 7 456 Kbps
    Width : 720 pixels
    Height : 576 pixels
    Display aspect ratio : 16/9
    Frame rate : 25.000 fps
    Standard : PAL
    Colorimetry : 4:2:0
    Scan type : Interlaced
    Scan order : Top Field First
    Bits/(Pixel*Frame) : 0.719
    Stream size : 801 KiB (68%)

    Audio
    ID : 160 (0xA0)
    Format : PCM
    Format settings, Endianness : Big
    Format settings, Sign : Signed
    Duration : 880ms
    Bit rate mode : Constant
    Bit rate : 1 536 Kbps
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 48.0 KHz
    Stream size : 165 KiB (14%)

    When I do a demux of the muxed file I get

    X:\testen\video\Witse>call "C:\Program Files\ffmpeg-0.5\ffmpeg.exe" -y -i "X:\testen\video\Witse\witse1_1_mux.mpg" -vn -f wav "X:\testen\video\Witse\witse1_1_mux.wav"
    FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
    configuration: --enable-gpl --enable-postproc --enable-swscale --enable-avfilt
    ...
    built on Mar 16 2009 16:09:18, gcc: 4.2.4 [Sherpya]
    Input #0, mpeg, from 'X:\testen\video\Witse\witse1_1_mux.mpg':
    Duration: 00:00:00.98, start: 0.500000, bitrate: 9783 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9]
    , 7456 kb/s, 50 tbr, 90k tbn, 50 tbc
    Stream #0.1[0xa0]: Audio: pcm_s16be, 48000 Hz, stereo, s16, 1536 kb/s
    Output #0, wav, to 'X:\testen\video\Witse\witse1_1_mux.wav':
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    Stream mapping:
    Stream #0.1 -> #0.0
    Press [q] to stop encoding
    [pcm_s16be @ 0x1724780]invalid PCM packet
    Error while decoding stream #0.1
    Error while decoding stream #0.1
    ... 90 identic lines omitted
    Error while decoding stream #0.1
    Error while decoding stream #0.1
    size= 2kB time=0.01 bitrate=1569.5kbits/s
    video:0kB audio:2kB global headers:0kB muxing overhead 2.178218%

    When I open the resulting wav-file in Cool Edit 2000, I have about 10ms valid audio.

    I hope you can help!
    Many thanks

  • Andre Saegerman

    November 2, 2010 at 7:53 pm

    some more info: when I multiplex with a mp3 file (instead of uncompressed audio) everything works fine.

    X:\testen\video\Witse>call "C:\Program Files\ffmpeg-0.5\ffmpeg.exe" -y -t 1 -v 8 -i "X:\testen\video\Witse\witse1_1.mpg" -i "X:\testen\video\Witse\witse1_1.mp3" -vcodec copy -acodec copy "X:\testen\video\Witse\witse1_1_mux.mpg"
    ...
    Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1)
    -> 25.00 (25/1)
    Input #0, mpegvideo, from 'X:\testen\video\Witse\witse1_1.mpg':
    Duration: 00:00:08.70, bitrate: 7455 kb/s
    Stream #0.0, 1/1200000: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 1
    6:9], 1/50, 7456 kb/s, 25 tbr, 1200k tbn, 50 tbc
    Input #1, mp3, from 'X:\testen\video\Witse\witse1_1.mp3':
    Duration: 00:00:08.76, start: 0.000000, bitrate: 128 kb/s
    Stream #1.0, 1/90000: Audio: mp3, 48000 Hz, stereo, s16, 128 kb/s
    Output #0, mpeg, to 'X:\testen\video\Witse\witse1_1_mux.mpg':
    Stream #0.0, 1/90000: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:
    9], 1/25, q=2-31, 7456 kb/s, 90k tbn, 25 tbc
    Stream #0.1, 1/90000: Audio: libmp3lame, 48000 Hz, stereo, s16, 128 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #1.0 -> #0.1
    Press [q] to stop encoding
    frame= 25 fps= 0 q=-1.0 Lsize= 998kB time=1.00 bitrate=8175.6kbits/s dup=
    0 drop=0
    video:977kB audio:16kB global headers:0kB muxing overhead 0.513607%

  • Michael Rampe

    November 2, 2010 at 9:45 pm

    A little bit of research shows that PCM is not supported in the mpg container format.

    https://en.wikipedia.org/wiki/Comparison_of_container_formats

    Can you use another type of container? what is your purpose?

    Michael

  • Andre Saegerman

    November 2, 2010 at 10:11 pm

    I’m sorry to disagree, I read in row “MPEG Video File (.mpg, .mpeg)”: Audio Formats supported “MPEG-1 Layers I, II, III (mp3), other formats only in private streams: LPCM[15]”
    LPCM is Linear Pulse Code modulation, that is uncompressed audio. Private stream ID: 0xA0.

    On https://dvd.sourceforge.net/dvdinfo/dvdmpeg.html you can read:
    Private stream 1 (Audio and subpictures)
    sub-stream 0x20 to 0x3f are subpictures
    sub-stream 0x80 to 0x87 are audio (AC3, DTS, SDDS)
    sub-stream 0xA0 to 0xA7 are LPCM audio

    I am able to multiplex the MPEG2 videofile and the wav-file with Womble MPEG Video Wizard 5.0 and the file plays without problem on Win Media Player, VLC player, Nero Show Time and stand-alone DVD player.
    I also tried Muxman 0.16 and this works for some MPEG2 videofiles, but not all (it complains about being the GOP too long (>36), although Womble MPEG GOP fixer says that all is OK).

    I am trying to write a “granny proof” application (wizard) to burn automatically a DVD with MPEG2 video and uncompressed audio with DVD-subtitles. So I need a command line multiplexer. My application runs OK for MP2 and MP3 audio.

  • Andre Saegerman

    November 2, 2010 at 10:24 pm

    Some more info: when I use the ffmpeg … -f dvd option, I can play the file in WMP and Nero Showtime, NOT VLC player

  • Douglas Jotblad

    November 21, 2010 at 2:24 am

    I had the same error so I tried different pcm codecs “pcm_alaw” gave me the result I wanted with no errors & quality was great!
    Hope this helps!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy