Page 1 of 1

Problem with Streaming H264 video

Posted: 09 Nov 2006 17:47
by gargamel67
I encoded a video with x264 GPL encoder in two passes in order to have very good video quality. I tried two formats: raw H264 and MP4 container.

I can play the video file with VLC, but when I enable "transcode" function in UDP or HTTP for example, the video won't play correctly nor stream in another instance.

I think there is an error while reader the headers because the video played is very large.

Someone has a solution or the same problem?


Pascal.

Posted: 09 Nov 2006 18:15
by DJ
What is the resolution of the file you created?

What is your machine (CPU & GPU)?

If you open your Task Manager while playing the video, what is the CPU usage?

Are you trying to watch the video on the same machine you are trying to stream from?

Have you tried looking at Messages for errors just playing the video and again while trying to stream the video?

Posted: 09 Nov 2006 18:18
by gargamel67
The file I encoded is 360x288.

Encoded with VLC: streaming OK
Encoded with x264: playing OK, but streaming in error.

When I'm just playing in VLC it uses less than 5% of CPU (I have a P4 Dual Core 3Ghz).

I tried to watch the video on the same machine and on another and the result is the same.

I'll try to paste some debug messages...

Posted: 09 Nov 2006 20:07
by DJ
Really this should work. But I have encountered some rather strange issues making H.264 files using x264 and playing the files in VLC.

1. If you correct the delay between audio and video much beyond a couple hundred MS, VLC may not work correctly and or refuse to play the file.

2. Currently it is recommended that raw AVC files not be used to mux to the final result with audio, Subtitles and or Chapters. You should mux the raw AVC file to MP4 or AVI before doing the final mux in whatever container. I have even found differences in the muxing order effecting the smoothness of the video.

I have not tried to stream this format yet:

1. Because of the overhead and lack of hardware support for video cards.

2. Because of starting issues that seem to have something to do with certain values in the header not being recognized correctly.

While VLC has made some corrections in this regard, I think it will take others to correct the problem also. AVC is new as as such is still in the experimental stage. The updates are ongoing for everyone.

Considering your system. Have you tried assigning VLC to 1 processor? A few users have stated a problem with timing that shouldn't exist.

Posted: 09 Nov 2006 21:04
by gargamel67
This is my log when I'm using the following command line:

vlc --file-logging -vv "D:\Mes documents\test_video\bande_test_half_size.avi.264" :sout=#duplicate{dst=display,dst=std{access=http,mux=ts,dst=:1234}}


Part of the log (I cut the end)
---

-- logger module started --
main debug: CPU has capabilities 486 586 MMX MMXEXT SSE SSE2 FPU
main debug: looking for memcpy module: 3 candidates
main debug: using memcpy module "memcpymmxext"
main debug: waiting for thread completion
main debug: thread 3624 (playlist) created at priority 0 (playlist/playlist.c:184)
main debug: waiting for thread completion
main debug: thread 3640 (preparser) created at priority 0 (playlist/playlist.c:210)
main debug: looking for interface module: 1 candidate
main debug: using interface module "hotkeys"
main debug: thread 3664 (interface) created at priority 0 (interface/interface.c:231)
main debug: looking for interface module: 1 candidate
logger: VLC media player - version 0.8.5 Janus - (c) 1996-2006 the VideoLAN team
logger:
Attention : si vous n’avez plus accès à l’interface graphique, ouvrez une invite de commande, allez dans le répertoire où vous avez installé VLC, et lancez « vlc -I wx ».

logger: using logger...
logger warning: no log filename provided, using `vlc-log.txt'
logger debug: opening logfile `vlc-log.txt'
main debug: using interface module "logger"
main debug: thread 3692 (interface) created at priority 0 (interface/interface.c:231)
main debug: adding playlist item `D:\Mes documents\test_video\bande_test_half_size.avi.264' ( D:\Mes documents\test_video\bande_test_half_size.avi.264 )
main debug: looking for interface module: 3 candidates
main debug: using interface module "wxwidgets"
main debug: thread 3724 (manager) created at priority 0 (interface/interface.c:216)
wxwidgets debug: Using last windows config '(-1,0,0,1280,1024)(0,219,245,389,91)(6,0,0,-1,150)'
wxwidgets debug: id=0 p=(219,245) s=(389,91)
wxwidgets debug: id=6 p=(0,0) s=(-1,150)
main debug: nothing requested, starting
main debug: creating new input thread
main debug: waiting for thread completion
main debug: creating statistics handler
main debug: thread 3932 (input) created at priority 1 (input/input.c:261)
main debug: stream=`duplicate'
main debug: looking for sout stream module: 1 candidate
stream_out_duplicate debug: creating 'duplicate'
stream_out_duplicate debug: * adding `display'
main debug: stream=`display'
main debug: looking for sout stream module: 1 candidate
main debug: using sout stream module "stream_out_display"
stream_out_duplicate debug: * adding `std{access=http,mux=ts,dst=:1234}'
main debug: stream=`std'
main debug: looking for sout stream module: 1 candidate
main debug: set sout option: sout-standard-access to http
main debug: set sout option: sout-standard-mux to ts
main debug: set sout option: sout-standard-dst to :1234
stream_out_standard debug: creating `http/ts://:1234'
stream_out_standard debug: using `http/ts://:1234'
main debug: looking for sout access module: 1 candidate
main: creating httpd
main debug: net: listening to port 1234
main debug: thread 4088 (httpd host thread) created at priority 0 (network/httpd.c:1076)
main debug: using sout access module "access_output_http"
stream_out_standard debug: access opened
main debug: looking for sout mux module: 1 candidate
mux_ts debug: shaping=200000 pcr=70000 dts_delay=400000
main debug: using sout mux module "mux_ts"
main debug: muxer support adding stream at any time
stream_out_standard debug: mux opened
main debug: using sout stream module "stream_out_standard"
main debug: using sout stream module "stream_out_duplicate"
main warning: drive letter D: found in source
main debug: `D:\Mes documents\test_video\bande_test_half_size.avi.264' gives access `' demux `' path `D:\Mes documents\test_video\bande_test_half_size.avi.264'
main debug: creating demux: access='' demux='' path='D:\Mes documents\test_video\bande_test_half_size.avi.264'
main debug: looking for access_demux module: 1 candidate
main debug: creating access '' path='D:\Mes documents\test_video\bande_test_half_size.avi.264'
main debug: looking for access2 module: 5 candidates
vcd debug: trying .cue file: D:\Mes documents\test_video\bande_test_half_size.avi.cue
access_file debug: opening file `D:\Mes documents\test_video\bande_test_half_size.avi.264'
main debug: using access2 module "access_file"
main debug: pre-buffering...
main debug: received first data for our buffer
main debug: pre-buffering done 1408981 bytes in 0s - 85992 kbytes/s
main debug: creating demux: access='' demux='' path='D:\Mes documents\test_video\bande_test_half_size.avi.264'
main debug: looking for demux2 module: 44 candidates
ts warning: TS module discarded (lost sync)
ffmpeg debug: detected format: h264
main debug: selecting program id=0
ffmpeg debug: adding es: video codec = h264
ffmpeg debug: AVFormat supported stream
ffmpeg debug: - format = h264 (raw H264 video format)
ffmpeg debug: - start time = -1
ffmpeg debug: - duration = -1
main debug: using demux2 module "ffmpeg"
main debug: looking for a subtitle file in D:\Mes documents\test_video\
main debug: looking for packetizer module: 17 candidates
packetizer_h264 debug: found NAL_SPS
main debug: using packetizer module "packetizer_h264"
main debug: stream out mode -> no decoder thread
main debug: starting in synch mode
main debug: `D:\Mes documents\test_video\bande_test_half_size.avi.264' successfully opened
packetizer_h264 debug: found NAL_PPS
main debug: adding a new input
stream_out_duplicate debug: duplicated a new stream codec=h264 (es=0 group=0)
main debug: looking for decoder module: 27 candidates
ffmpeg debug: libavcodec initialized (interface 3344640 )
ffmpeg debug: postprocessing disabled
ffmpeg debug: ffmpeg codec (h264) started
main debug: using decoder module "ffmpeg"
main debug: thread 4220 (decoder) created at priority 0 (input/decoder.c:159)
stream_out_duplicate debug: - added for output 0
main debug: adding a new input
mux_ts debug: adding input codec=h264 pid=68
mux_ts debug: new PCR PID is 68
stream_out_duplicate debug: - added for output 1
main warning: trying to send non-dated packet to stream output!
main warning: trying to send non-dated packet to stream output!
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: cannot decode one frame (10020 bytes)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: cannot decode one frame (74 bytes)
main warning: late buffer for mux input (141000)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: cannot decode one frame (42667 bytes)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
mux_ts debug: adjusting rate at 0/400000 (235/0)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: cannot decode one frame (101 bytes)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: cannot decode one frame (37 bytes)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: cannot decode one frame (99 bytes)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: cannot decode one frame (4217 bytes)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: cannot decode one frame (185 bytes)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: cannot decode one frame (57 bytes)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: cannot decode one frame (38 bytes)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: non existing PPS referenced
(h264@00D4D730)
ffmpeg warning: decode_slice_header error
(h264@00D4D730)
ffmpeg warning: cannot decode one frame (28 bytes)
ffmpeg debug: concealing 0 DC, 0 AC, 0 MV errors
(h264@00D4D730)
main debug: no usable vout present, spawning one
main debug: window size: 9905x288
main debug: looking for video output module: 5 candidates
vout_directx debug: creating DirectXEventThread
main debug: waiting for thread completion
vout_directx debug: DirectXCreateWindow
vout_directx debug: created video sub-window
main debug: thread 4268 (DirectX Events Thread) created at priority 0 (directx.c:263)
vout_directx debug: DirectXEventThread running
vout_directx debug: DirectXInitDDraw
vout_directx debug: directx-device:
vout_directx debug: DirectXEnumCallback: Pilote d'affichage principal, display
vout_directx debug: DirectXEnumCallback: NVIDIA GeForce 7600 GT, \\.\DISPLAY1
vout_directx debug: selecting NVIDIA GeForce 7600 GT, \\.\DISPLAY1
vout_directx debug: DirectXEnumCallback: NVIDIA GeForce 7600 GT, \\.\DISPLAY2
vout_directx debug: screen dimensions (0x0,1280x1024)
vout_directx debug: DirectDraw Capabilities: overlay=1 yuvoverlay=1 can_deinterlace_overlay=1 colorkey=1 stretch=1 bltfourcc=1
vout_directx debug: align_boundary_src=0,0 align_boundary_dest=1,1 align_size_src=0,0 align_size_dest=0,0
vout_directx debug: End DirectXInitDDraw
vout_directx debug: DirectXCreateDisplay
vout_directx debug: DirectXCreateClipper
main debug: Registering subpicture channel, ID: 2
main debug: Registering subpicture channel, ID: 3
main debug: Registering subpicture channel, ID: 4
main debug: Registering subpicture channel, ID: 5
vout_directx debug: disabling screen saver
main debug: using video output module "vout_directx"
main debug: waiting for thread completion
vout_directx debug: NewPictureVec overlay:yes chroma:YV12
vout_directx debug: YUV overlay created successfully
vout_directx debug: End NewPictureVec (succeeded)
main debug: got 1 direct buffer(s)
main debug: picture in 352x288 (0,0,352x288), chroma I420, ar 268381189:432000, sar 44886:1595
main debug: picture user 352x288 (0,0,352x288), chroma I420, ar 268381189:432000, sar 44886:1595
main debug: picture out 352x288 (0,0,352x288), chroma I420, ar 268381189:432000, sar 44886:1595
main debug: direct render, mapping render pictures 0-6 to system pictures 1-7
main debug: thread 4300 (video output) created at priority 1 (video_output/video_output.c:421)
ffmpeg debug: concealing 0 DC, 0 AC, 0 MV errors
(h264@00D4D730)
ffmpeg warning: reference picture missing during reorder
(h264@00D4D730)
ffmpeg warning: reference picture missing during reorder
(h264@00D4D730)
ffmpeg warning: reference picture missing during reorder
(h264@00D4D730)
ffmpeg warning: reference picture missing during reorder
(h264@00D4D730)
ffmpeg debug: concealing 0 DC, 0 AC, 0 MV errors
(h264@00D4D730)
ffmpeg debug: concealing 0 DC, 0 AC, 0 MV errors
(h264@00D4D730)

Posted: 09 Nov 2006 22:47
by DJ
I see the problem. But there are only 2 players in existence (to the best of my knowledge) that will play raw .264 or .h264 files. VLC and MPlayer. Mplayer tries to pull the framerate out of the file. But the frame rate is not a requirement for H.264. I don't believe VLC does this as there is no reporting for frame rate, nor does it appear to run on speed.

When the file is muxed into a container the default frame rate for most muxers is 25fps. So you must specify the frame rate in any muxer even though the frame rate may be in the header information for the file. Understand that most formats are dealt with in the same manor. However recently one of the developers for x264 posted with GPAC (MP4) a way to automatically use the internal frame rate of a file made with x264. This is of coarse assuming that the option was turned on when the file was made. From what I have seen thus far this also appears to be true for any program that makes AVC files not only x264.

What this all means to you! There is no way a program can play or stream a raw h.264 file properly without being able to determine the frame rate of the file and at present this appears to be an impossible task for a raw file in the AVC format. The posting by the x264 developer does pose a solution to this problem but who knows how long it will take for others to implement it?????

There is an easy answer here! It was described in my earlier post! Mux the file first and give it a frame rate. :P This will at least put you on a proper path not saying that it will work when it comes to h.264 for reasons I have already described, but you do have a chance this way. One user says the one out of twenty tries does work and I'm sure these odds will improve in the future.