[MPlayer-users] [Solved] convert an mp3 into a mpg2 transport stream with null video

David Timms dtimms at iinet.net.au
Mon Jan 26 15:50:05 CET 2009


Nico Sabbi wrote:
> more something like:
> 
> mencoder -of lavf -lavfopts format=mpegts -o outputfile.ts -audiofile 
> input_audio.mp3  -rawvideo w=320:h=240:fps=25  -ovc frameno 
>  -demuxer rawvideo  /dev/zero  
OK, this complained of missing audio coder type, so set it to copy; it 
then succeeds; the resultant ts has no video:
----
mencoder -of lavf -lavfopts format=mpegts -ovc frameno -o outputfile.ts 
-audiofile inputaudio.mp3 -oac copy -rawvideo w=320:h=240:fps=25 -ovc 
frameno -demuxer rawvideo /dev/zero

MEncoder dev-SVN-r27514-4.3.2 (C) 2000-2008 MPlayer Team
CPU: AMD Athlon(tm) XP 2600+ (Family: 6, Model: 8, Stepping: 1)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled with runtime CPU detection.
success: format: 0  data: 0x0 - 0x0
rawvideo file format detected.
Audio only file format detected.
[V] filefmt:65536  fourcc:0x30323449  size:320x240  fps:25.000 
ftime:=0.0400
** MUXER_LAVF 
*****************************************************************
REMEMBER: MEncoder's libavformat muxing is presently broken and can generate
INCORRECT files in the presence of B-frames. Moreover, due to bugs MPlayer
will play these INCORRECT files as if nothing were wrong!
*******************************************************************************
OK, exit.
audiocodec: framecopy (format=55 chans=2 rate=44100 bits=16 B/s=16000 
sample-0)
VIDEO CODEC ID: 0
AUDIO CODEC ID: 15001, TAG: 0
Writing header...
Writing index...23946f ( 0%) 2559.70fps Trem:   0min   0mb  A-V:0.040 
[0:127]

Recommended video bitrate for 650MB CD: 280
Recommended video bitrate for 700MB CD: 313
Recommended video bitrate for 800MB CD: 378
Recommended video bitrate for 2 x 650MB CD: 701
Recommended video bitrate for 2 x 700MB CD: 766
Recommended video bitrate for 2 x 800MB CD: 895

Video stream:    0.800 kbit/s  (99 B/s)  size: 1295784 bytes  12957.840 
secs  323946 frames

Audio stream:  128.000 kbit/s  (15999 B/s)  size: 199163820 bytes 
12447.739 secs
----
mplayer:
TS file format detected.
NO VIDEO! AUDIO MPA(pid=257) NO SUBS (yet)!  PROGRAM N. 1
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
mpg123: Can't rewind stream by 1162 bits!
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   9.7 (09.6) of 14158.6 ( 3:55:58.5)  0.5% 

Exiting... (Quit)
----
ffmpeg:
   built on Nov 20 2008 14:37:49, gcc: 4.3.2 20081105 (Red Hat 4.3.2-7)
[mp3 @ 0x9526ff0]mdb:388, lastbuf:0 skipping granule 0
[mp3 @ 0x9526ff0]mdb:388, lastbuf:0 skipping granule 0
[mp3 @ 0x9526ff0]mdb:388, lastbuf:0 skipping granule 1
[mp3 @ 0x9526ff0]mdb:388, lastbuf:0 skipping granule 1

Seems stream 1 codec frame rate differs from container frame rate: inf 
(1/0) -> nan (0/0)
Input #0, mpegts, from 'outputfile.ts':
   Duration: 03:27:27.52, start: 0.000000, bitrate: 145 kb/s
   Program 1 Service01
     Stream #0.0[0x101]: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s

> eventually changing -ovc frameno with -ovc lavc -lavcopts 
> vcodec=mpeg1video:br=200
I'm not sure if you meant do a second pass with the result from the 
first pass, or that frameno is deprecated so you would do it this way in 
the future instead ?

Final successful command I used is: (needed to expand br to vbitrate)
mencoder -of lavf -lavfopts format=mpegts -ovc frameno -o outputfile.ts 
-audiofile inputaudio.mp3 -oac copy -rawvideo w=320:h=240:fps=25 -ovc 
lavc -lavcopts vcodec=mpeg1video:vbitrate=200 -demuxer rawvideo /dev/zero
----
ffmpeg:
    built on Nov 20 2008 14:37:49, gcc: 4.3.2 20081105 (Red Hat 4.3.2-7)
[mp3 @ 0x80c46c0]mdb:388, lastbuf:0 skipping granule 0
[mp3 @ 0x80c46c0]mdb:388, lastbuf:0 skipping granule 0
[mp3 @ 0x80c46c0]mdb:388, lastbuf:0 skipping granule 1
[mp3 @ 0x80c46c0]mdb:388, lastbuf:0 skipping granule 1
[mpegts @ 0x80b1ad0]Invalid timestamps stream=0, pts=0, dts=8589930993, 
size=165
Input #0, mpegts, from 'outputfile.ts':
   Duration: 00:03:36.08, start: 0.000000, bitrate: 152 kb/s
   Program 1 Service01
     Stream #0.0[0x100]: Video: mpeg1video, yuv420p, 320x240 [PAR 1:1 
DAR 4:3], 104857 kb/s, 25.00 tb(r)
     Stream #0.1[0x101]: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
----
mplayer:
   TS file format detected.
VIDEO MPEG2(pid=256) AUDIO MPA(pid=257) NO SUBS (yet)!  PROGRAM N. 1
VIDEO:  MPEG1  320x240  (aspect 1)  25.000 fps    0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 320 x 240 (preferred colorspace: Mpeg PES)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
VDecoder init failed :(
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmpeg1] vfm: ffmpeg (FFmpeg MPEG-1)
==========================================================================
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
mpg123: Can't rewind stream by 1162 bits!
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
Starting playback...
VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [xv] 320x240 => 320x240 Planar YV12
A:  -0.1 V:   0.0 A-V: -0.146 ct: -0.015 332/332 ??% ??% ??,?% 0 0

When played, it does in fact have null = middle-green static video, and 
the audio sounds like it hasn't been harmed.

As Mr Burns might utter: "Exsssellent !" ;-)

Actually, two more Q:
1. is there a way to make the video pure black, or of a single png ?
2. is vbitrate in bit or kbit (1000 bit man doesn't indicate which) ?

DaveT.



More information about the MPlayer-users mailing list