staxrip / staxrip

🎞 Video encoding GUI for Windows.
MIT License
2.18k stars 122 forks source link

Timestamps are unset in a packet for stream 0 #524

Closed rsp4jack closed 3 years ago

rsp4jack commented 3 years ago

Describe the bug When StaxRip export a video using FLV, FFmpeg will error:

[flv @ 000001e5315265c0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[flv @ 000001e5315265c0] Packet is missing PTS
av_interleaved_write_frame(): Invalid argument
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

Full log:


------------------------- System Environment -------------------------

StaxRip    : 2.1.8.0
Windows    : Windows 10 Pro 2009
Language   : Chinese (Simplified, China)
CPU        : Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
GPU        : Intel(R) HD Graphics 630
Resolution : 1920 x 1080
DPI        : 96
Code Page  : 936

----------------------- Media Info Source File -----------------------

E:\render\0001-0180.mp4

General
Complete name            : E:\render\0001-0180.mp4
Format                   : MPEG-4
Format profile           : Base Media
Codec ID                 : isom (isom/avc1)
File size                : 223 KiB
Duration                 : 7 s 500 ms
Overall bit rate mode    : Variable
Overall bit rate         : 243 kb/s
Encoded date             : UTC 2021-02-19 08:18:32
Tagged date              : UTC 2021-02-19 08:18:32

Video
ID                       : 1
Format                   : AVC
Format/Info              : Advanced Video Codec
Format profile           : High@L4
Format settings          : CABAC / 3 Ref Frames
Format, CABAC            : Yes
Format, Reference frames : 3 frames
Codec ID                 : avc1
Codec ID/Info            : Advanced Video Coding
Duration                 : 7 s 500 ms
Bit rate                 : 53.7 kb/s
Maximum bit rate         : 118 kb/s
Width                    : 1 920 pixels
Height                   : 1 080 pixels
Display aspect ratio     : 16:9
Frame rate mode          : Constant
Frame rate               : 24.000 FPS
Color space              : YUV
Chroma subsampling       : 4:2:0
Bit depth                : 8 bits
Scan type                : Progressive
Bits/(Pixel*Frame)       : 0.001
Stream size              : 49.2 KiB (22%)
Encoded date             : UTC 2021-02-19 08:18:32
Tagged date              : UTC 2021-02-19 08:18:32
Codec configuration box  : avcC

Audio
ID                       : 2
Format                   : AAC LC
Format/Info              : Advanced Audio Codec Low Complexity
Codec ID                 : mp4a-40-2
Duration                 : 7 s 445 ms
Bit rate mode            : Variable
Bit rate                 : 185 kb/s
Maximum bit rate         : 196 kb/s
Channel(s)               : 2 channels
Channel layout           : L R
Sampling rate            : 48.0 kHz
Frame rate               : 46.875 FPS (1024 SPF)
Compression mode         : Lossy
Stream size              : 169 KiB (76%)
Encoded date             : UTC 2021-02-19 08:18:32
Tagged date              : UTC 2021-02-19 08:18:32

----------------------------- Demux audio -----------------------------

MP4Box 1.1.0-rev447-g8c190b551-gcc10.2.0 Patman

D:\download\StaxRip-x64-2.1.8.0-Stable\Apps\Support\MP4Box\MP4Box.exe -single 2 -out E:\render\0001-0180_temp\ID1.m4a E:\render\0001-0180.mp4

Start:    下午 4:19:31
End:      下午 4:19:31
Duration: 00:00:00

General
Complete name         : E:\render\0001-0180_temp\ID1.m4a
Format                : MPEG-4
Format profile        : Base Media
Codec ID              : isom (isom)
File size             : 171 KiB
Duration              : 7 s 445 ms
Overall bit rate mode : Variable
Overall bit rate      : 188 kb/s
Encoded date          : UTC 2021-02-19 08:19:31
Tagged date           : UTC 2021-02-19 08:19:31

Audio
ID                    : 2
Format                : AAC LC
Format/Info           : Advanced Audio Codec Low Complexity
Format profile        : AAC@L2
Codec ID              : mp4a-40-2
Duration              : 7 s 445 ms
Bit rate mode         : Variable
Bit rate              : 185 kb/s
Nominal bit rate      : 5 148 b/s
Maximum bit rate      : 143 kb/s
Channel(s)            : 2 channels
Channel layout        : L R
Sampling rate         : 48.0 kHz
Frame rate            : 46.875 FPS (1024 SPF)
Compression mode      : Lossy
Stream size           : 169 KiB (99%)
Encoded date          : UTC 2021-02-19 08:19:31
Tagged date           : UTC 2021-02-19 08:19:31

---------------------------- Configuration ----------------------------

Template                : Automatic Workflow
Video Encoder Profile   : Intel | H.264
Container/Muxer Profile : ffmpeg | FLV

--------------------------- AviSynth Script ---------------------------

AddAutoloadDir("D:\download\StaxRip-x64-2.1.8.0-Stable\Apps\FrameServer\AviSynth\plugins")
LoadPlugin("D:\download\StaxRip-x64-2.1.8.0-Stable\Apps\Plugins\Dual\L-SMASH-Works\LSMASHSource.dll")
LSMASHVideoSource("E:\render\0001-0180.mp4")

------------------------- Source Script Info -------------------------

Width     : 1920
Height    : 1080
Frames    : 180
Time      : 00:07.500
Framerate : 24 (24/1)
Format    : YUV420P8

------------------------- Target Script Info -------------------------

Width     : 1920
Height    : 1080
Frames    : 180
Time      : 00:07.500
Framerate : 24 (24/1)
Format    : YUV420P8

--------------------------- Video encoding ---------------------------

QSVEnc 4.12

D:\download\StaxRip-x64-2.1.8.0-Stable\Apps\Encoders\QSVEnc\QSVEncC64.exe --avsdll D:\download\StaxRip-x64-2.1.8.0-Stable\Apps\FrameServer\AviSynth\AviSynth.dll --fallback-rc --cqp 24:26:27 -i E:\render\0001-0180_temp\0001-0180_h264.avs -o E:\render\0001-0180_temp\0001-0180_h264_out.h264

--------------------------------------------------------------------------------
E:\render\0001-0180_temp\0001-0180_h264_out.h264
--------------------------------------------------------------------------------
QSVEncC (x64) 4.12 (r1979) by rigaya, Nov 23 2020 10:32:05 (VC 1928/Win/avx2)
OS             Windows 10 x64 (19042)
CPU Info       Intel Core i5-7500 @ 3.40GHz [TB: 3.59GHz] (4C/4T) <Kabylake>
GPU Info       Intel HD Graphics 630 (24EU) 350-1100MHz [65W] (27.20.100.8853)
Media SDK      QuickSyncVideo (hardware encoder) PG, 1st GPU, API v1.33
Async Depth    4 frames
Buffer Memory  d3d9, 3 input buffer, 15 work buffer
Input Info     AviSynth+ 3.7.0 r3382(yv12)->nv12 [AVX2], 1920x1080, 24/1 fps
AVSync         cfr
Output         H.264/AVC High @ Level 4
               1920x1080p 1:1 24.000fps (24/1fps)
Target usage   4 - balanced
Encode Mode    Constant QP (CQP)
CQP Value      I:24  P:26  B:27
QP Limit       min: none, max: none
Trellis        Auto
Ref frames     3 frames
Bframes        3 frames, B-pyramid: on
Max GOP Length 240 frames
Ext. Features  QPOffset 
encoded 180 frames, 121.29 fps, 29.12 kbps, 0.03 MB
encode time 0:00:01, CPULoad: 55.2
frame type IDR   1
frame type I     2,  total size  0.01 MB
frame type P    45,  total size  0.01 MB
frame type B   134,  total size  0.01 MB

Start:    下午 4:21:35
End:      下午 4:21:39
Duration: 00:00:03

General
Complete name            : E:\render\0001-0180_temp\0001-0180_h264_out.h264
Format                   : AVC
Format/Info              : Advanced Video Codec
File size                : 26.7 KiB
Duration                 : 7 s 500 ms
Overall bit rate         : 29.1 kb/s

Video
Format                   : AVC
Format/Info              : Advanced Video Codec
Format profile           : High@L4
Format settings          : CABAC / 3 Ref Frames
Format, CABAC            : Yes
Format, Reference frames : 3 frames
Duration                 : 7 s 500 ms
Bit rate                 : 29.1 kb/s
Width                    : 1 920 pixels
Height                   : 1 080 pixels
Display aspect ratio     : 16:9
Frame rate               : 24.000 FPS
Color space              : YUV
Chroma subsampling       : 4:2:0
Bit depth                : 8 bits
Scan type                : Progressive
Bits/(Pixel*Frame)       : 0.001
Stream size              : 26.7 KiB (100%)

------------------------- Error Muxing to FLV -------------------------

Muxing to FLV returned error exit code: 1 (0x1)

It's unclear what the exit code means, in case it's a Windows system error then it possibly means:

函数不正确。

---------------------------- Muxing to FLV ----------------------------

ffmpeg N-100448-gab6a56773f-x64-gcc10.2.0 Patman

D:\download\StaxRip-x64-2.1.8.0-Stable\Apps\FrameServer\AviSynth\ffmpeg.exe -i E:\render\0001-0180_temp\0001-0180_h264_out.h264 -i E:\render\0001-0180.mp4 -map 0:v -map 1:1 -c:v copy -c:a copy -y -hide_banner -strict -2 E:\render\0001-0180_h264.flv

Input #0, h264, from 'E:\render\0001-0180_temp\0001-0180_h264_out.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24.08 fps, 24 tbr, 1200k tbn, 48 tbc
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'E:\render\0001-0180.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2021-02-19T08:18:32.000000Z
  Duration: 00:00:07.50, start: 0.000000, bitrate: 243 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 53 kb/s, 24 fps, 24 tbr, 96 tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2021-02-19T08:18:32.000000Z
      vendor_id       : [0][0][0][0]
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 185 kb/s (default)
    Metadata:
      creation_time   : 2021-02-19T08:18:32.000000Z
      vendor_id       : [0][0][0][0]
Output #0, flv, to 'E:\render\0001-0180_h264.flv':
  Metadata:
    encoder         : Lavf58.65.100
    Stream #0:0: Video: h264 (High) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24.08 fps, 24 tbr, 1k tbn, 1200k tbc
    Stream #0:1(und): Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp, 185 kb/s (default)
    Metadata:
      creation_time   : 2021-02-19T08:18:32.000000Z
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[flv @ 000001e5315265c0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[flv @ 000001e5315265c0] Packet is missing PTS
av_interleaved_write_frame(): Invalid argument
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

---------------------------- Muxing to FLV ----------------------------

ffmpeg N-100448-gab6a56773f-x64-gcc10.2.0 Patman

D:\download\StaxRip-x64-2.1.8.0-Stable\Apps\FrameServer\AviSynth\ffmpeg.exe -i E:\render\0001-0180_temp\0001-0180_h264_out.h264 -i E:\render\0001-0180.mp4 -map 0:v -map 1:1 -c:v copy -c:a copy -y -hide_banner -strict -2 E:\render\0001-0180_h264.flv

Input #0, h264, from 'E:\render\0001-0180_temp\0001-0180_h264_out.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24.08 fps, 24 tbr, 1200k tbn, 48 tbc
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'E:\render\0001-0180.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2021-02-19T08:18:32.000000Z
  Duration: 00:00:07.50, start: 0.000000, bitrate: 243 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 53 kb/s, 24 fps, 24 tbr, 96 tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2021-02-19T08:18:32.000000Z
      vendor_id       : [0][0][0][0]
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 185 kb/s (default)
    Metadata:
      creation_time   : 2021-02-19T08:18:32.000000Z
      vendor_id       : [0][0][0][0]
Output #0, flv, to 'E:\render\0001-0180_h264.flv':
  Metadata:
    encoder         : Lavf58.65.100
    Stream #0:0: Video: h264 (High) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24.08 fps, 24 tbr, 1k tbn, 1200k tbc
    Stream #0:1(und): Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp, 185 kb/s (default)
    Metadata:
      creation_time   : 2021-02-19T08:18:32.000000Z
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[flv @ 000001e5315265c0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[flv @ 000001e5315265c0] Packet is missing PTS
av_interleaved_write_frame(): Invalid argument
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

Start:    下午 4:21:39
End:      下午 4:21:40
Duration: 00:00:00

How to reproduce the issue

  1. Using 'Intel-h.264' encoder. (All encoder can reproduce too)
  2. 'AviSynth or VapourSynth' being used.
  3. Set container to FLV
  4. Set audio to "#1" Copy/Mux
  5. Start the job

Provide information

Notes before posting

Additional context

This error will be raised when use all ffmpeg container(maybe, but FLV of course), all source video file format, all encoder/decoder.

Please be as clear and as detailed as possible

JJKylee commented 3 years ago

This happens because the encoded elementary video stream .h264 does not have timestamps in it, and ffmpeg does not seem to support muxing .h264 into an flv format. (You can mux .h264 into an mp4 in ffmpeg, though.) So, you can get around this issue by muxing to an mp4 file first, and then remuxing the mp4 file to flv. (I tested and confirmed this myself.)

Dendraspis commented 3 years ago

...or mkv. 😁

ghost commented 3 years ago

@Creepercdn please do not mux your videos to flv anymore, the flv format is officially dead as of end 2020. Anyway, it is old and deprecated. Please use, as @JJKylee recommends, the mkv or mp4 containers...

ghost commented 3 years ago

@Creepercdn please close this thread when you've read it!

vihai commented 2 years ago

I am using ffmpeg to take a live stream via RTSP (which is missing PTS) and send to an NGINX RTMP server (which AFAIK only support FLV as container).

It works with ffmpeg 4.4.

What will it be in the future?