Log in

View Full Version : Playback issues with h.264/aac FLV


theophile
14th April 2009, 06:37
First of all, I did not encode this file. The source is a streaming website. Also, I am using Ubuntu Linux, with versions of x264 and ffmpeg built from source.

If I try to play the file with mplayer or ffmpeg, I get this error and the player process dies:
[h264 @ 0x8d8bd80]AVC: Consumed only 1 bytes instead of 7714
[h264 @ 0x8d8bd80]no frame!
[h264 @ 0x8d8bd80]AVC: Consumed only 1 bytes instead of 7573
[h264 @ 0x8d8bd80]no frame!
[h264 @ 0x8d8bd80]AVC: Consumed only 1 bytes instead of 7487
[h264 @ 0x8d8bd80]no frame!
[h264 @ 0x8d8bd80]AVC: Consumed only 1 bytes instead of 8533
[h264 @ 0x8d8bd80]no frame!
[h264 @ 0x8d8bd80]AVC: Consumed only 1 bytes instead of 8325
[h264 @ 0x8d8bd80]no frame!
[h264 @ 0x8d8bd80]AVC: Consumed only 1 bytes instead of 7656
[h264 @ 0x8d8bd80]no frame!
[h264 @ 0x8d8bd80]AVC: Consumed only 1 bytes instead of 8213
[h264 @ 0x8d8bd80]no frame!

Using mediainfo, the file looks like this:
General
Complete name : 720pA.flv
Format : Flash Video
File size : 413 MiB
_width : 800.000
_height : 450.000
_framerate : 29.970
_videocodecid : 7.000
_videodatarate : 2100.000
_audiodatarate : 48.000

Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L3.1
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Muxing mode : Container profile=Unknown@3.1
Width : 800 pixels
Height : 450 pixels
Display aspect ratio : 16/9
Frame rate mode : Variable
Frame rate : 29.970 fps
Standard : Component
Resolution : 24 bits
Colorimetry : 4:2:0
Scan type : Progressive

Audio
Format : AAC
Format/Info : Advanced Audio Codec
Format version : Version 4
Format profile : Main
Channel(s) : 1 channel
Channel positions : C
Sampling rate : 48.0 KHz
Resolution : 16 bits

If I play using the -novideo option in mplayer, I get sound.

Now, if I use the Windows program FLV Extract on the file, I can demux it into .264 and .aac streams. Played individually, these files work perfectly. In addition, FlowPlayer can play the original .flv file without a problem.

One thing I notice is the difference in how ffmpeg identifies the video stream of the original .flv as compared to the extracted .264. First, here's the info from the original .flv:

Seems stream 0 codec frame rate differs from container frame rate: 2000.00 (2000/1) -> 29.97 (30000/1001)
Input #0, flv, from '720pA.flv':
Duration: N/A, start: 71376.321000, bitrate: N/A
Stream #0.0: Video: h264, yuv420p, 29.97 tbr, 1k tbn, 2k tbc
Stream #0.1: Audio: aac, 48000 Hz, mono, s16

And here it is form the extracted .264:

Seems stream 0 codec frame rate differs from container frame rate: 59.94 (60000/1001) -> 29.97 (60000/2002)
Input #0, h264, from '720pA.264':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: h264, yuv420p, 800x450 [PAR 1:1 DAR 16:9], 29.97 tbr, 1200k tbn, 59.94 tbc

I can see the differences but don't know what to make of it.

I've uploaded a smaller sample file (6.5MB) using the same container and producing the same errors as above. If it makes a difference, the original file extension on the server was .mp4. The file is located here:

http://monopedilos.com/testfile.flv

Can anyone help me figure out why mplayer, ffmpeg, and vlc all choke on this file? My end goal is to figure out a way to play this file without remuxing it because I would like to be able to play it "live" as it streams.

Any assistance much appreciated. Thanks!

Selur
14th April 2009, 07:00
Not sure if it helps, but here are some additional findings about the file:
1. doesn't play under windows to (directshow and mplayer)
2. extracting the streams with FLV Extract and opening the .264 file with DVACDec gives a:
Found NALU type 0, len 0 undefined, ignore NALU, moving on
3. the timecodes, extracted by FLV Extract, seem to be wrong, when muxed with mkvmerge it would result in a 9h 30m 35sec file. ;)
4. muxing the audio&video without the timecodes creates a valid file (length 1min 11sec)

My guess: something went terribly wrong in the creation of this file. (sidenote: personally I prefer to use .mp4 as container instead of .flv for h264/aac content)

Cu Selur

theophile
14th April 2009, 07:14
A little background, if it helps.

The file source is the MLB.TV service provided by Major League Baseball (mlb.com). They use Swarmcast/Autobahn technology to delivery high resolution content to paying subscribers. By necessity, the source files are created live and on-the-fly so subscribers can watch live baseball games. The local .flv I am trying to play is created by pointing mplayer at the local port opened by the Autobahn program and using the -dumpstream option to save the content locally. I am only saving the content for debugging purposes as the player errors described above also occur while trying to play the data "live."

In short, the original .flv was not created from a fixed-duration source file but from a live source. Another person who is working on this project made the following observations about a similar local file he created in the same fashion:

Watching the raw h264 file, mine switches resolutions on the fly (the 'auto-adjust' setting in the official flash player is finnicky on my side, so I guess I picked up an autoadjust stream to dump). However, I can see the raw resolutions they are streaming at.

The problem with the .flv container is I believe they've set up a VBR container with 'links' (as in the MKV format) of sorts, due to the requirement to auto-adjust quality, the bitrate of the video stream will necessarily change, as well as the frame size. When you play the raw stream, mplayer is reading the FLV headers and trying to figure out what the correct frame size, FPS, etc. are, but it can't because the FLV container has the 'variable' setup I mentioned earlier. That's why you get ffmpeg/mplayer errors of 'no frame' and 'consumed only....instead of x bytes', because it's not able perform the adjustments dictated by the flv container. This is also why when you remux the audio and video streams, there are difficulties in getting a/v sync.

According to my thinking, FlowPlayer can play this file. If FlowPlayer is open source, there's no reason it should be able to play something that ffmpeg/mplayer can't.

BlueCop
14th April 2009, 16:35
hey theophile why not just remux to something this is playable like say mkv? i have some posts about this from last year here.

http://forum.doom9.org/showthread.php?p=1189824#post1189824

here is another thread about remuxing h264 flvs
http://forum.doom9.org/showthread.php?t=139540

theophile
14th April 2009, 16:49
BlueCop,

Thanks for your response. I probably would focus more on remuxing, but the problem is I need to be able to play these files "live." Since the entire purpose is to be able to watch live baseball games, I can't wait until the file is finished writing in order to do a bunch of processing on it.

If there were a way to do "realtime" remuxing, that might be a viable option, but I suspect that there would be serious A/V sync issues. I really need to figure out how to play this file without modification. If that's not possible, I'd like to see if I can learn why, so I can file a useful bug report with the ffmpeg guys.

Selur
14th April 2009, 17:43
The local .flv I am trying to play is created by pointing mplayer at the local port opened by the Autobahn program and using the -dumpstream option to save the content locally.
Did you ever try to dum the stream into an .mp4 file instead of an .flv file?

theophile
14th April 2009, 18:52
Did you ever try to dum the stream into an .mp4 file instead of an .flv file?

Yes but it makes no difference. It still won't play and mediainfo still identifies it as an FLV.

theophile
14th April 2009, 19:23
I've created a bug report with ffmpeg. If anyone can supplement the report with more info, I would greatly appreciate it. Thanks!

https://roundup.ffmpeg.org/roundup/ffmpeg/issue987

theophile
16th April 2009, 23:49
Fixed!