Opened 18 months ago

Last modified 18 months ago

#10016 new defect

FFmpeg exit code is 0 when pre-signed URL expires diring a transcode

Reported by: Mark Himsley Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

When FFmpeg is reading from an S3 source file via HTTP and has to skip to a new byte-offset it makes a new HTTP connection.

When the pre-signed URL to the S3 source file is past its expiry FFmpeg gets the 403 error and terminates all threads.

When the pre-signed URL has already expired so the first hit to s3 fails then FFmpeg will return an exit code of 1.

When the pre-signed URL expires during the transcode that FFmpeg will return an exit code of 0. Software detecting failure assumes the transcode completed successfully, and yet it didn't, and FFmpeg should know that and should exit signalling that appropriately.

This seems wrong.

How to reproduce:

$ ffmpeg \
 -loglevel debug \
 -i "http://127.0.0.1:9000/tmp/keyframe_test_96_4898.mov?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=WGQVW7MO881C0ENOHKAG%2F20221108%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221108T174110Z&X-Amz-Expires=60&X-Amz-Security-Token=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NLZXkiOiJXR1FWVzdNTzg4MUMwRU5PSEtBRyIsImV4cCI6MTY2Nzk3MDUyMSwicGFyZW50IjoibWluaW9hZG1pbiJ9.FJ2kOzmVGYVbC6Sp7w_pa371qlgFgU-CGIWav2b5sSRdjXhchqUhnEX6PqRdxu7yyMPNu4DtzKiEQTlPtYgcpw&X-Amz-SignedHeaders=host&versionId=null&X-Amz-Signature=c17e67e67e302ba43300c35a99dfc50c3593c2443ae48a10044cac3a30dddb6a" \
...

...
[tcp @ 0x7fd6cc016840] Original list of addresses:
[tcp @ 0x7fd6cc016840] Address 127.0.0.1 port 9000
[tcp @ 0x7fd6cc016840] Interleaved list of addresses:
[tcp @ 0x7fd6cc016840] Address 127.0.0.1 port 9000
[tcp @ 0x7fd6cc016840] Starting connection attempt to 127.0.0.1 port 9000
[tcp @ 0x7fd6cc016840] Successfully connected to 127.0.0.1 port 9000
[http @ 0x5555555e2d40] request: GET /tmp/keyframe_test_96_4898.mov?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=WGQVW7MO881C0ENOHKAG%2F20221108%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221108T174110Z&X-Amz-Expires=60&X-Amz-Security-Token=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NLZXkiOiJXR1FWVzdNTzg4MUMwRU5PSEtBRyIsImV4cCI6MTY2Nzk3MDUyMSwicGFyZW50IjoibWluaW9hZG1pbiJ9.FJ2kOzmVGYVbC6Sp7w_pa371qlgFgU-CGIWav2b5sSRdjXhchqUhnEX6PqRdxu7yyMPNu4DtzKiEQTlPtYgcpw&X-Amz-SignedHeaders=host&versionId=null&X-Amz-Signature=c17e67e67e302ba43300c35a99dfc50c3593c2443ae48a10044cac3a30dddb6a HTTP/1.1
User-Agent: Lavf/59.34.101
Accept: */*
Range: bytes=24136341-
Connection: close
Host: 127.0.0.1:9000
Icy-MetaData: 1


[h264 @ 0x555555dabb00] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0x555555dabb00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
    Last message repeated 4 times
[libx264 @ 0x555555608980] frame=8646 QP=7.00 NAL=2 Slice:B Poc:292 I:0    P:3    SKIP:2037 size=33 bytes
[http @ 0x5555555e2d40] HTTP error 403 Forbidden
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5555555e2200] stream 1, offset 0x17086f0: partial file
Error demuxing input file 0: Invalid data found when processing input
Terminating demuxer thread 0
...

$ echo $?
0

Initially discussed on Slack:

https://video-dev.slack.com/archives/CDJNDBNSH/p1667931152410659
https://video-dev.slack.com/archives/CDJNDBNSH/p1667934935907569

Change History (1)

comment:1 by Mark Himsley, 18 months ago

Version: unspecifiedgit-master
Note: See TracTickets for help on using tickets.