1

I need to take a screenshot/snapshot from .ts files. Currently using the command:

ffmpeg -ss 00:06:05.6710000 -i input.ts -frames:v 1 -q:v 1 output.jpeg

This works fine for .mp4 files, but for .ts files the output file is just garbage. I've tried different values for -frames:v 1 and -q:v 1, but same result. Note, ffmpeg will convert .ts to mp4, so I'm guessing it's a question of correct parameters, however all my searches have been fruitless. Command output is:

ffmpeg version 7.0.1-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers

built with gcc 13.2.0 (Rev5, Built by MSYS2 project)

configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint

libavutil 59. 8.100 / 59. 8.100

libavcodec 61. 3.100 / 61. 3.100

libavformat 61. 1.100 / 61. 1.100

libavdevice 61. 1.100 / 61. 1.100

libavfilter 10. 1.100 / 10. 1.100

libswscale 8. 1.100 / 8. 1.100

libswresample 5. 1.100 / 5. 1.100

libpostproc 58. 1.100 / 58. 1.100

[mpegts @ 0000020349fd7a00] Could not find codec parameters for stream 1 (Unknown: none ([164][0][0][0] / 0x00A4)): unknown codec

Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options

Input #0, mpegts, from 'input.ts':

Duration: 00:12:02.03, start: 8961.200000, bitrate: 1560 kb/s

Program 1

Stream #0:0[0xa5]: Video: hevc (Main) ([36][0][0][0] / 0x0024), yuv420p(tv), 2688x1520, 30 fps, 30 tbr, 90k tbn

Stream #0:1[0xa4]: Unknown: none ([164][0][0][0] / 0x00A4)

Stream mapping:

Stream #0:0 -> #0:0 (hevc (native) -> mjpeg (native))

Press [q] to stop, [?] for help

[hevc @ 000002034a5d0540] Could not find ref with POC 49

[swscaler @ 00000203512ce040] deprecated pixel format used, make sure you did set range correctly

Output #0, image2, to 'output.jpeg':

Metadata:

encoder         : Lavf61.1.100

Stream #0:0: Video: mjpeg, yuvj420p(pc, progressive), 2688x1520, q=2-31, 200 kb/s, 30 fps, 30 tbn

  Metadata:

    encoder         : Lavc61.3.100 mjpeg

  Side data:

    cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A

[image2 @ 000002034a5ce5c0] The specified filename 'output.jpeg' does not contain an image sequence pattern or a pattern is invalid.

[image2 @ 000002034a5ce5c0] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image.

[out#0/image2 @ 000002034a4d3140] video:73KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown

frame= 1 fps=0.0 q=1.0 Lsize=N/A time=00:00:00.03 bitrate=N/A dup=1 drop=0 speed=0.317x

How can I create the snapshot?

15
  • Can you convert THIS .ts file into .mp4 successfully? Just to check if there are issues with the .ts file itself. Commented Jun 11 at 22:54
  • Yes, I can convert .ts to mp4 successfully with ffmpeg.
    – AVG
    Commented Jun 12 at 0:59
  • I think that it might be a bug related to H.265 (HEVC) video codec used with .ts files. Place the -ss after the -i (also add -update 1): ffmpeg -y -i input.ts -ss 00:06:05.6710000 -frames:v 1 -update 1 -q:v 1 output.jpeg. Note that converting to MP4 with -c copy (ffmpeg -y -i input.ts -c copy input.mp4) and using -ss before the -i can be faster if -ss value is large.
    – Rotem
    Commented Jun 12 at 7:57
  • Thanks @Rotem. Placing -ss after -i works, but takes too long. Depending on the -ss value, it can take several minutes, which will not be acceptable. -update doesn't seem to do anything. Any other ideas?
    – AVG
    Commented Jun 12 at 13:36
  • While I can imply that you are successfully converting THIS .ts file, my question was precise because in diagnostics we need precision. Perhaps there is a language issue, but please note that we are asking whether THIS .ts file can be successfully and correctly converted to an mp4 file. I recommend that you use precise language, especially when precision is requested. Commented Jun 12 at 14:19

0

You must log in to answer this question.

Browse other questions tagged .