[Libav-user] Problems decoding h264 (Baseline, yuvj420p) ip camera stream

tapas tapascst at gmail.com
Mon Jun 1 05:55:49 CEST 2015


Hi ,

I am also running into same issue . I can record but I cannot broadcast my
h264 rtsp stream from my ip camera.

here is the command which I am trying :

*/home/broadcaster/bin/ffmpeg -use_wallclock_as_timestamps 1 -r 25
-thread_queue_size 51200 -threads 4 -i
rtsp://admin:admin@192.168.0.200:8557/PSIA/Streaming/channels/2?videoCodecType=H.264
-use_wallclock_as_timestamps 1 -r 25 -b:v 2048k -bufsize 20480 -c:v copy -f
avi cam.avi*

*Output during recording:*
ffmpeg version 2.6.2 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.1 (Ubuntu 4.9.1-16ubuntu6)
  configuration: --prefix=/home/broadcaster/ffmpeg_2.6_building/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags=-I/home/broadcaster/ffmpeg_2.6_building/ffmpeg_build/include
--extra-ldflags=-L/home/broadcaster/ffmpeg_2.6_building/ffmpeg_build/lib
--bindir=/home/broadcaster/bin --enable-gpl --enable-libass
--enable-libfdk-aac --enable-libfreetype --enable-libmp3lame
--enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-nonfree --disable-inline-asm
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[h264 @ 0x2ba4cc0] RTP: missed 5 packets
[h264 @ 0x2ba4cc0] RTP: missed 1 packets
[h264 @ 0x2ba4cc0] RTP: missed 17 packets
[h264 @ 0x2ba4cc0] RTP: missed 14 packets
Input #0, rtsp, from
'rtsp://admin:admin@192.168.0.200:8557/PSIA/Streaming/channels/2?videoCodecType=H.264':
  Metadata:
    title           : RTSP/RTP stream from Network Video Server
    comment         : 2?videoCodecType=H.264
  Duration: N/A, start: 1433129457.153767, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuvj420p(pc), 1920x1080, 25 fps, 25
tbr, 90k tbn, 50 tbc
Output #0, avi, to 'cam.avi':
  Metadata:
    INAM            : RTSP/RTP stream from Network Video Server
    ICMT            : 2?videoCodecType=H.264
    ISFT            : Lavf56.25.101
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuvj420p, 1920x1080,
q=2-31, 2048 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
===========================================


If I play this file in vlc then vlc can also play. If I use libx264 to
re-encode then I can put it in flv container but if I try to copy stream and
put it in flv container then it does not work at all. . Even vlc cannot play
such video file.

Here is the command which I am using for broadcasting with ffmpeg: 

*/home/broadcaster/bin/ffmpeg -use_wallclock_as_timestamps 1 -r 25
-thread_queue_size 51200 -threads 4 -i
"rtsp://admin:admin@$1:8557/PSIA/Streaming/channels/2?videoCodecType=H.264"
-use_wallclock_as_timestamps 1 -r 25 -b:v 2048k -bufsize 20480 -c:v copy -f
flv rtmp://vaughn.tv.url*


Please also note that I collected stream info from vlc player as it can play
this rtsp stream directly from camera. here is the video codec info
generated by vlc : 


Codec: H264 - MPEG-4 AVC (part 10) (h264)
Resolution: 1920x1090
Display resolution: 1920x1080
Frame rate: 25
Decoded format: Planar 4:2:0 YUV full scale

So in summary:
1) ffmpeg is detecting incoming rtsp pixel format as yuvj420p . 
2) ffmpeg can record it to avi container without re-encoding it again using
above command 
3) but ffmpeg cannot re-stream/save it to any flv container file without
re-encoding again with libx264. 

my question is why we are hitting this issue for yuvj420p pixel format in
ffmpeg ? Is this a bug in ffmpeg  ? 

I build latest ffmpeg 2.6.2 from source code and It works fine perfectly for
my other ip camera which has yuv420p pixel format for h264 rtsp stream.

Please suggest



--
View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Problems-decoding-h264-Baseline-yuvj420p-ip-camera-stream-tp4657799p4661188.html
Sent from the libav-users mailing list archive at Nabble.com.


More information about the Libav-user mailing list