Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#414 closed defect (invalid)

Ошибка 500 при использовании seek для файлов с mp4s stream

Reported by: Sergey Beduev Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.3.x
Keywords: mp4, seek, isma Cc:
uname -a: Linux d4436.example.net 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.3.8
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-pcre-jit --with-debug --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-mail --with-mail_ssl_module --with-openssl=/build/buildd/nginx-1.3.8/debian/openssl-1.0.1c --add-module=/build/buildd/nginx-1.3.8/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.3.8/debian/modules/chunkin-nginx-module --add-module=/build/buildd/nginx-1.3.8/debian/modules/headers-more-nginx-module --add-module=/build/buildd/nginx-1.3.8/debian/modules/nginx-development-kit --add-module=/build/buildd/nginx-1.3.8/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.3.8/debian/modules/nginx-http-push --add-module=/build/buildd/nginx-1.3.8/debian/modules/nginx-lua --add-module=/build/buildd/nginx-1.3.8/debian/modules/nginx-upload-module --add-module=/build/buildd/nginx-1.3.8/debian/modules/nginx-upload-progress --add-module=/build/buildd/nginx-1.3.8/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.3.8/debian/modules/nginx-dav-ext-module

Description

Для файлов содержащих mp4s strems при попытке выполнить seek, nginx возвращает ошибку 500

Добавление ISMA спецификации производится через MP4Box
MP4Box -isma -inter 0.5

Вывод ffprobe

Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: isommp423gp5
    creation_time   : 2013-09-18 20:29:15
  Duration: 00:01:45.51, start: 0.000000, bitrate: 1617 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x528 [SAR 11:15 DAR 1:1], 1553 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 73 kb/s
    Metadata:
      creation_time   : 2013-09-18 20:29:15
      handler_name    : GPAC ISO Audio Handler
    Stream #0:2(und): Data: none (mp4s / 0x7334706D)
    Metadata:
      creation_time   : 2013-09-18 20:29:15
      handler_name    : GPAC MPEG-4 OD Handler
    Stream #0:3(und): Data: none (mp4s / 0x7334706D)
    Metadata:
      creation_time   : 2013-09-18 20:29:15
      handler_name    : GPAC MPEG-4 Scene Description Handler

Решением может быть игнорирование обработки mp4s stream.

--- nginx-1.3.8/src/http/modules/ngx_http_mp4_module.c  2013-05-06 06:26:50.000000000 -0400
+++ nginx-1.3.8a/src/http/modules/ngx_http_mp4_module.c 2013-09-18 17:16:49.741142097 -0400
@@ -1849,6 +1849,10 @@
                    ngx_mp4_get_32value(stsd_atom->entries),
                    4, stsd_atom->media_name);
 
+    if (ngx_strncmp(stsd_atom->media_name, "mp4s", 4) == 0) {
+        return NGX_DECLINED;
+    }
+
     trak = ngx_mp4_last_trak(mp4);
 
     atom = &trak->stsd_atom_buf;

Attachments (2)

mp4sbug_nginx_debug.txt (121.0 KB ) - added by Sergey Beduev 7 years ago.
debug вывод nginx
mp4sbug_atomicpresley_atoms.txt (5.3 KB ) - added by Sergey Beduev 7 years ago.
вывод AtomicPresley -test

Download all attachments as: .zip

Change History (4)

by Sergey Beduev, 7 years ago

Attachment: mp4sbug_nginx_debug.txt added

debug вывод nginx

by Sergey Beduev, 7 years ago

вывод AtomicPresley -test

comment:1 by Maxim Dounin, 7 years ago

Resolution: invalid
Status: newclosed

Судя по debug log'у, файл содержит дорожки, которые короче, чем запрошенный seek. Такого nginx не поддерживает (отсюда и ошибка 500), и игнорирование дорожек по типу - совершенно точно не решение.

comment:2 by Roman Arutyunyan <arut@…>, 6 years ago

In 5730c0193842dfb6bb30ca3d2401a7b36be12b4f/nginx:

Mp4: skip tracks shorter than seek position (ticket #414).

Mp4 module does not check movie and track durations when reading
file. Instead it generates errors when track metadata is shorter
than seek position. Now such tracks are skipped and movie duration
check is performed at file read stage.

Note: See TracTickets for help on using tickets.