Opened 12 years ago

Closed 10 years ago

Last modified 10 years ago

#1720 closed defect (fixed)

ffmpeg with -vcodec copy -acodec copy creates files "without audio" for certain players

Reported by: Roger Pack Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mpegps bounty
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug: $title

How to reproduce:

 I noticed with this file:

http://rogerdpack.t28.net/incoming/sintel.mpg

 and this command:

 $ ffmpeg -y -i sintel.mpg -t 60 -vcodec copy -acodec copy out.mpg
 ffmpeg version N-43577-g045f8dd Copyright (c) 2000-2012 the FFmpeg developers
   built on Aug 15 2012 14:10:50 with gcc 4.7.1 (GCC)
   configuration: --enable-memalign-hack --arch=x86 --enable-gpl
 --enable-libx264 --enable-avisynth --enable-libxvid
 --target-os=mingw32
 --cross-prefix=/home/rogerdpack/dev/ffmpeg-windows-build-helpers/builds/mingw-w64-i686/bin/i686-w64-mingw32-
 --pkg-config=pkg-config --enable-libmp3lame --enable-version3
 --enable-libvo-aacenc --enable-libvpx --extra-libs=-lws2_32
 --extra-libs=-lpthread --enable-zlib --extra-libs=-lwinmm
 --extra-libs=-lgdi32 --enable-librtmp --enable-runtime-cpudetect
   libavutil      51. 69.100 / 51. 69.100
   libavcodec     54. 52.100 / 54. 52.100
   libavformat    54. 23.100 / 54. 23.100
   libavdevice    54.  2.100 / 54.  2.100
   libavfilter     3.  9.100 /  3.  9.100
   libswscale      2.  1.101 /  2.  1.101
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
 [mpeg2video @ 01C2F6A0] ac-tex damaged at 40 7
 [mpeg2video @ 01C2F6A0] Warning MVs not available
 [mpeg2video @ 01C2F6A0] concealing 1035 DC, 1035 AC, 1035 MV errors in I frame
 [mpeg @ 03361800] max_analyze_duration 5000000 reached at 5024000
 Input #0, mpeg, from 'sintel.mpg':
   Duration: 00:14:47.58, start: 0.233367, bitrate: 4132 kb/s
     Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480
 [SAR 32:27 DAR 16:9], 7000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94
 tbc
     Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), s16, 448 kb/s
 Output #0, mpeg, to 'out.mpg':
   Metadata:
     encoder         : Lavf54.23.100
     Stream #0:0: Video: mpeg2video, yuv420p, 720x480 [SAR 32:27 DAR
 16:9], q=2-31, 7000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
     Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), 448 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 frame= 1638 fps=0.0 q=-1.0 Lsize=   32396kB time=00:01:00.00
 bitrate=4423.1kbits/s
 video:28947kB audio:3281kB subtitle:0 global headers:0kB muxing
 overhead 0.520095%

command succeeds. File is playable (with audio) by ffplay, but has "no audio" in either VLC or Windows Media Player.

If I dump it to out.avi, the resultant file has "no video" in WMP, but does have audio, and plays fine in VLC. Or should I file that as a separate ticket?

MediaInfo seems to reveal it having an audio track ok.

Attachments (2)

sintel.2.5.mpg (2.4 MB ) - added by Roger Pack 12 years ago.
there is an initial "thud" that tells you whether audio is working or not.
out.mpg (2.4 MB ) - added by Roger Pack 12 years ago.
the resultant file that has "no audio VLC, no audio WMP" even though the original works with both

Change History (28)

by Roger Pack, 12 years ago

Attachment: sintel.2.5.mpg added

there is an initial "thud" that tells you whether audio is working or not.

by Roger Pack, 12 years ago

Attachment: out.mpg added

the resultant file that has "no audio VLC, no audio WMP" even though the original works with both

in reply to:  description comment:1 by Michael Niedermayer, 12 years ago

Replying to rogerdpack:

If I dump it to out.avi, the resultant file has "no video" in WMP, but does have audio, and plays fine in VLC. Or should I file that as a separate ticket?

id say, thats probably a seperate issue

comment:2 by Carl Eugen Hoyos, 12 years ago

Is this also reproducible with a shorter input file? If yes, please attach a sample.

comment:3 by Roger Pack, 12 years ago

shorter than the sintel.2.5.mpg file attached? It seems to reproduce it.

comment:4 by Carl Eugen Hoyos, 12 years ago

Component: undeterminedavformat
Status: newopen
Version: unspecifiedgit-master

Sorry, the sample is sufficient.

comment:5 by Carl Eugen Hoyos, 11 years ago

Keywords: mpegps added
Reproduced by developer: set

sintel.2.5.mpg plays fine with WMP, both remuxing and re-encoding ac3 in mpeg-ps leads to files that play silent with WMP.

comment:6 by Roger Pack, 11 years ago

appears to lack audio with mplayer, as well:

$ mplayer.exe out.mpg
MPlayer GIT-EDL-0.5-gcc4.5.1 (C) 2000-2012 MPlayer Team

Playing out.mpg.
libavformat version 54.46.100 (internal)
MPEG-PS file format detected.
MPEG: No audio stream found -> no sound.

comment:7 by Carl Eugen Hoyos, 11 years ago

MPlayer is distributed via svn...

comment:8 by Roger Pack, 11 years ago

That was my own distro of svn (which I believe is pretty up to date). Here's one that is based off an SVN revision:

MPlayer-rtm-svn-34401\mplayer.exe out.mpg
MPlayer Sherpya-SVN-r34401-4.6.2 (C) 2000-2011 MPlayer Team

Playing out.mpg.
MPEG-PS file format detected.
MPEG: No audio stream found -> no sound.
VIDEO: MPEG2 720x480 (aspect 3) 29.970 fps 7000.0 kbps (875.0 kbyte/s)
Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2)
==========================================================================
Audio: no sound

Last edited 11 years ago by Roger Pack (previous) (diff)

comment:9 by Carl Eugen Hoyos, 11 years ago

Works fine with mplayer -demuxer lavf.

in reply to:  6 comment:10 by kadmandux, 11 years ago

Replying to rogerdpack:

appears to lack audio with mplayer, as well:
MPEG: No audio stream found -> no sound.

Please have a look here for a workaround:

http://www.das-werkstatt.com/forum/werkstatt/viewtopic.php?f=7&t=1834

You must make a little change in the parameters:

Instead of -target dvd use -target pal-dvd or what is applicable in your case

Last edited 11 years ago by kadmandux (previous) (diff)

comment:11 by Roger Pack, 11 years ago

Latest builds of ffmpeg/mplayer

MPlayer sherpya-r36349+gb24f15c-4.6 (C) 2000-2013 MPlayer Team
ffmpeg version N-55515-gbbbd959

still seem to show this problem

adjusting mplayer's -tsprobe or lavdopts probesize didn't seem to make a difference, though I may have been adjusting them wrong.

Applying "-target ntsc-dvd" does seem to make it so mplayer can read the audio. Interesting, I wonder which parameter it is setting fixes it...

comment:12 by Roger Pack, 10 years ago

I am offering a bounty of $100 USD if anybody can fix this particular one (i.e. with vcodec copy acodec copy, mplayer's internal demuxer [VLC's probably has the same issue] is able to read the audio in the file). Thanks!

comment:13 by llogan, 10 years ago

Keywords: bounty added

comment:14 by llogan, 10 years ago

For bounty see comment 12: ticket:1720#comment:12

Last edited 10 years ago by llogan (previous) (diff)

comment:15 by reimar, 10 years ago

I believe there is nothing to fix except user (un-)friendliness.
The extensions .mpg/.mpeg select the "mpeg" muxer, full name "MPEG-1 Systems / MPEG program stream".
Nobody really cares about the "MPEG-1 Systems" format, and certainly AC3 is not generally supported in it (I am not 100% sure it is correct of FFmpeg to allow it).
You need to instead select one of the MPEG-2 PS formats.
Either by using one of -f vob, -f svcd or -f dvd or using .vob or .dvd as extension.
I suspect the -target thing somehow might cause the muxer to select that format as well? Not sure.

comment:16 by reimar, 10 years ago

My recommendations would be:
1) Make the "Output #0" thing print the long name of the muxer
2) Make the MPEG-1 Systems muxer print a warning when trying to mux more advanced formats like MPEG-2 video or AC3 audio and other things not commonly supported in it.

comment:17 by Roger Pack, 10 years ago

Appears reimar is right.

$ file sintel.mpg
sintel.mpg: MPEG sequence, v2, program multiplex
$ file sintel.copied.mpg
sintel.copied.mpg: MPEG sequence, v1, system multiplex
$ file sintel.copied.vob.mpg # with -f vob
sintel.copied.vob.mpg: MPEG sequence, v2, program multiplex

So...I guess either make mpeg v2 the default somehow (which might be nice for newbs like me), or big warnings, like remair mentioned in comment 16...
Let me know if/how things progress either way.
Thanks.
-roger-

comment:18 by reimar, 10 years ago

I have the suspicion that the MPEG-1 format might be default because it's the only one that Windows Media Player (used to) be able to play out of the box.
So far my "solution" is to force users to explicitly specify what they want, but it's not exactly a good solution.

comment:19 by Doug, 10 years ago

I've just encountered this same issue (I believe). However, it seems related to how the audio stream is marked inside the container ("Dolby AC3" in the original video). Note that vlc plays all clips fine, but totem cannot play the audio ("unknown codec", except for the different.avi and original.avi files, which are fine).

Output from file command:

original.avi: RIFF (little-endian) data, AVI, 720 x 384, 25.00 fps, video: XviD, audio: Dolby AC3 (6 channels, 48000 Hz)

generated with -c copy or -c:v copy -c:a copy
copy.avi: RIFF (little-endian) data, AVI, 720 x 384, 25.00 fps, video: XviD, audio: (6 channels, 48000 Hz)

generated with -c copy -c:a mp3
mp3.avi: RIFF (little-endian) data, AVI, 720 x 384, 25.00 fps, video: XviD, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)

completely different file, generated earlier with LiVES
different.avi: RIFF (little-endian) data, AVI, 576 x 460, 25.00 fps, video: DivX 4, audio: (mono, 22050 Hz)

I'm not familiar with the stream info encoding, so I'm not sure what it's called that's missing between audio: and the ( (e.i.: the specific codec used for that audio stream), but I think that's why some players can't play the audio copied by ffmpeg. When the audio is transcoded (into mp3, in my test cases), then the stream type is inserted into the audio stream info.

From my programming experience, it seems like the audio "codec type" doesn't get transferred when the -c copy option applies to AC3 audio (and maybe others: I've only tried mp3 to mp3 and that copied fine).

The original.avi is a 1.5GB file, so I'm not trying to attach these, but I can maybe find a smaller original Dolby AC3 file to work with and upload those, if needed.

Doug

comment:20 by Doug, 10 years ago

I should have put this in the last post, too (running on Mint's LMDE, following Debian Jessie): ffmpeg -version:
ffmpeg version 1.2.2
built on Aug 10 2013 08:17:36 with gcc 4.8 (Debian 4.8.1-8)
configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/i386-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libiec61883 --enable-libfdk-aac --enable-libdc1394 --disable-altivec --disable-armv5te --disable-armv6 --disable-vis --shlibdir=/usr/lib/i386-linux-gnu
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

Last edited 10 years ago by Doug (previous) (diff)

comment:21 by Roger Pack, 10 years ago

Is there possibly a way to make it so that the default for the .mpg file extension is version 2 instead of version 1 perhaps? My guess is that most people want version 2, typically, these days...?

comment:22 by Carl Eugen Hoyos, 10 years ago

Most people don't want changes in the default behaviour but please feel free to send a patch.

comment:23 by Carl Eugen Hoyos, 10 years ago

Resolution: fixed
Status: openclosed

I committed a patch that warns users when muxing ac-3 (and dts and pcm_s16be) into MPEG-1 system streams. I don't think we should change default behaviour, but since the patch is trivial please feel free to forward the discussion to the ffmpeg-devel mailing list.

Last edited 10 years ago by Carl Eugen Hoyos (previous) (diff)

comment:24 by Roger Pack, 10 years ago

nice:

[mpeg @ 049766c0] ac3 in MPEG-1 system streams is not widely supported, consider using the vob or the dvd muxer to force a MPEG-2 program stream.

(Or do you think that perhaps it would be better to check for "approved/typical" codecs and warn when it doesn't match that list instead?) Something to think about, in case anybody tries putting other weird formats in them.

Either way, if you send me a patch that makes MPEG-2 system streams default (for me to try to push through dev later) then I'd say you deserve the bounty (email me rogerdpack@gmail.com for $ transfer :).

Thanks, at least now users can understand now...

@Illusion yours seems odd as well, could you possibly file a new trac ticket for it, since it feels like it might be barely a separate issue. Thank you!

comment:25 by kadmandux, 10 years ago

@reimar:
You need to instead select one of the MPEG-2 PS formats.
Either by using one of -f vob, -f svcd or -f dvd or using .vob or .dvd as
extension.
I suspect the -target thing somehow might cause the muxer to select that format
as well? Not sure.

You're right!

https://github.com/FFmpeg/FFmpeg/blob/master/ffmpeg_opt.c

    } else if (!strcmp(arg, "dvd")) {
        opt_video_codec(o, "c:v", "mpeg2video");
        opt_audio_codec(o, "c:a", "ac3");
        parse_option(o, "f", "dvd", options);

comment:26 by kadmandux, 10 years ago

@rogerdpack

If you're still interested in the patch to make MPEG-2 system streams default, let me know to take a look at it .... and post your email in a truncated form (like this one: rogerdpack at domain dot topleveldomain) to be able to send it to you (it seems that -to avoid spam- an standard email address is masked when posted)

Regards

Last edited 10 years ago by kadmandux (previous) (diff)
Note: See TracTickets for help on using tickets.