0

I would like to create a ts stream from a still image.

I tried:

ffmpeg -f image2 -i image.png test.mp4
ffmpeg -i test.mp4 -c copy output.ts

test.m3u:

#EXTM3U
#EXTINF:-1 tvg-id="none" tvg-name="failo" tvg-logo="" group-title="title",test
http://192.168.1.54/test.m3u8

test.m3u8

#EXTM3U
#EXT-X-TARGETDURATION:5
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:5, no desc
http://192.168.1.54/output.ts

What I am doing wrong? The file is unplayable, I tried in VLC.

main debug: using access module "access"
main debug: looking for stream_filter module matching "prefetch,cache_block": 26 candidates
prefetch debug: using 103 bytes buffer, 103 bytes read
main debug: using stream_filter module "prefetch"
main debug: looking for stream_filter module matching "any": 26 candidates
prefetch debug: end of stream
main debug: no stream_filter modules matched
main debug: looking for stream_directory module matching "any": 1 candidates
main debug: no stream_directory modules matched
main debug: attachment of directory-extractor failed for http://192.168.1.54/test.m3u
main debug: looking for stream_filter module matching "record": 26 candidates
main debug: using stream_filter module "record"
main debug: creating demux: access='http' demux='any' location='192.168.1.54/test.m3u' file='(null)'
main debug: looking for demux module matching "any": 55 candidates
adaptive debug: Updated playlist ID http://192.168.1.54/test.m3u, after 0s
adaptive debug: Representation http://192.168.1.54/test.m3u
adaptive debug:  Segment #1 url=http://192.168.1.54/output.ts duration 300
adaptive debug: Period
adaptive debug:  BaseAdaptationSet default_id#0
adaptive debug:   Representation http://192.168.1.54/test.m3u
adaptive debug:    Segment #1 url=http://192.168.1.54/output.ts duration 300
adaptive debug: opening playlist file (192.168.1.54/test.m3u)
main debug: using demux module "adaptive"
main debug: looking for meta reader module matching "any": 2 candidates
main debug: no meta reader modules matched
main debug: `http://192.168.1.54/test.m3u' successfully opened
macosx debug: Continue to use IOKit assertion NoIdleSleepAssertion (41968)
macosx debug: Continue to use IOKit assertion NoIdleSleepAssertion (41968)
adaptive debug: Retrieving http://192.168.1.54:80/test.m3u @0
main debug: creating access: http://192.168.1.54:80/test.m3u
main debug: looking for access module matching "http": 24 candidates
http debug: resolving 192.168.1.54 ...
http debug: outgoing request:
GET /test.m3u HTTP/1.1
Host: 192.168.1.54:80
Accept: */*
Accept-Language: en_US
User-Agent: VLC/3.0.16 LibVLC/3.0.16
Range: bytes=0-

1 Answer 1

1

It looks like a bug in VLC - VLC fails to play a single frame video file.
Other players (FFplay and MPC-HC for example) manage to play the single frame.

You may create a 2 frames video file using -stream_loop 1 option.

You don't have to create an MP4 file first - you may select TS file:

ffmpeg -y -stream_loop 1 -r 1 -i image.png -vcodec libx264 -crf 17 -pix_fmt yuv420p output.ts
  • -y - Overwrite the file if already exist.
  • -stream_loop 1 - Loop the input image twice (loop one more time).
  • -r 1 - Select 1fps framerate.
  • -vcodec libx264 - select H.264 video encoder.
  • -crf 17 - Select constant (quality) rate factor (lower value applies higher quality).
  • -pix_fmt yuv420p Select the encoded pixel format.

I don't know how to play the m3u and m3u8 files.
I have played output.ts file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .