Page 1 of 1

playing h264 from stdin vs file shows no video

Posted: 28 Apr 2017 21:13
by edjames
I have an annex B stream starting with 00 00 00 01 67 that plays fine with:

cvlc xxx.h264

but when I try with

cvlc - < xxx.h264
or
cat xxx.h264 | cvlc -

I get a black window of the correct size (1080p) for several seconds, then it closes.

WIth verbose logging, this appears to be the difference:

main input debug: Buffering 0%
main input debug: Buffering 0%
main input debug: Buffering 0%
main input debug: Buffering 0%
main input debug: Buffering 0%
main input debug: Buffering 0%
main input debug: Buffering 0%
main input debug: Buffering 0%

vs

main input debug: Buffering 0%
main input debug: Buffering 13%
main input debug: Buffering 26%
main input debug: Buffering 40%
main input debug: Buffering 53%
main input debug: Buffering 66%
main input debug: Buffering 80%

I tried adding things like --codec h264 but they have no effect. It's not my video file, I get the same results with a reference video made with avconv, eg

ppmmake white 640 480 > white.ppm
ppmmake red 100 100 > red.ppm
for n in $(seq 0 540); do
pnmpaste red.ppm $n 240 < white.ppm | ppmtojpeg
done | avconv -f image2pipe -c:v mjpeg -i - -r 25 -map 0 xxx.h264

What are the correct args to cvlc to make it play a file like this from stdin? Thanks! --ed

Re: playing h264 from stdin vs file shows no video

Posted: 06 May 2017 19:15
by RĂ©mi Denis-Courmont
In principles, VLC treats a file opened explicitly or through the shell the same way:

Code: Select all

cvlc xxx.h264 cvlc - < xxx.h264
There may be some differences however, as the current implementation will not seek. I am not sure if this should be considered a bug. In any case, piping to VLC is intrinsically different:

Code: Select all

cat xxx.h264 | vlc -
In that case, VLC gets a pipe, not a regular file. So it cannot seek and cannot know if the stream is paced/live or not. This messes up buffering. You should only use a pipe if the file is actually a live stream.