[Libav-user] Hardware encoder ARM input as device input

Marcin Woźniak marcin.wozniak at intermania.pl
Tue Feb 6 09:30:57 EET 2018


Finnaly i was able to set up timing data in h264 stream.
Trying to save this as -f test.h264 produces good file, trying to mux it 
drops FPS to tenth of original (25 fps becomes 2.5 fps and bitrate from 
1024 kb/s to little more than 100 kbs).
PTS of every NAL unit is different exactly by 40000 (sometimes 40001).
What am i doing wrong?

Input #0, hisi, from '/dev/video':
   Duration: N/A, start: 895789.311044, bitrate: N/A
     Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 
1920x1080, 25 fps, 25 tbr, 90k tbn, 50 tbc
File 'out.mkv' already exists. Overwrite ? [y/N] getchnattr worksy
Output #0, matroska, to 'out.mkv':
   Metadata:
     encoder         : Lavf57.83.100
     Stream #0:0: Video: h264 (Main) (H264 / 0x34363248), yuvj420p(pc, 
bt709, progressive), 1920x1080, q=2-31, 25 fps, 25 tbr, 1k tbn, 90k tbc
Stream mapping:
   Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x1a1c4b0] Non-monotonous DTS in output stream 0:0; 
previous: 0, current: -2627; changing to 0. This may result in incorrect 
timestamps in the output file.
[matroska @ 0x1a1c4b0] Non-monotonous DTS in output stream 0:0; 
previous: 0, current: -2182; changing to 0. This may result in incorrect 
timestamps in the output file.
[matroska @ 0x1a1c4b0] Non-monotonous DTS in output stream 0:0; 
previous: 0, current: -1738; changing to 0. This may result in incorrect 
timestamps in the output file.
[matroska @ 0x1a1c4b0] Non-monotonous DTS in output stream 0:0; 
previous: 0, current: -1293; changing to 0. This may result in incorrect 
timestamps in the output file.
[matroska @ 0x1a1c4b0] Non-monotonous DTS in output stream 0:0; 
previous: 0, current: -849; changing to 0. This may result in incorrect 
timestamps in the output file.
[matroska @ 0x1a1c4b0] Non-monotonous DTS in output stream 0:0; 
previous: 0, current: -404; changing to 0. This may result in incorrect 
timestamps in the output file.
frame=   24 fps=3.5 q=-1.0 Lsize=      94kB time=00:00:07.15 bitrate= 
107.6kbits/s speed=1.04x
video:93kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
muxing overhead: 0.929940%

Marcin


W dniu 04.02.2018 o 16:24, Marcin Woźniak pisze:
> Hello,
> I try to implement an HiSilicon H264 encoder direct input as ffmpeg 
> libavdevice source (someking like V4L linux for cameras with H264 
> source driver).
> I successfully recieve H264 packets with NAL units and set correct PTS 
> according to source packet.
> I am stuck at the moment where timing data is not extracted from raw 
> H264 paassed data and looks like this:
>
> Input #0, armdevice, from '/dev/video':
>   Duration: N/A, start: 0.000000, bitrate: N/A
>     Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 
> 1920x1080, 1000k tbr, 1000k tbn, 2000k tbc
>
> Resolution is okay but timing data is wrong. I passed SPS and PPS of 
> incomming data in "read_packet".
>
> In shotcut:
> 1. Open H264 encoder using low-level API in device_open
> 2. Initialize encoder with fps and resolution using API in device_init
> 3. In read_packet i get NAL units from buffer and:
> av_new_packet(pkt,total);
> memcpy(pkt->data,buffer) -> stub
>  pkt->pts = buffer.u64PTS;
> pkt->size = size
> and return packet.
>
> Profile level is guessed okay but not the timing data.
>
> What am i doing wrong?
>  Marcin
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180206/b45c6644/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: marcin_wozniak.vcf
Type: text/x-vcard
Size: 291 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180206/b45c6644/attachment.vcf>


More information about the Libav-user mailing list