
Recherche avancée
Médias (91)
-
Valkaama DVD Cover Outside
4 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
Valkaama DVD Label
4 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Valkaama DVD Cover Inside
4 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
1,000,000
27 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Demon Seed
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Four of Us are Dying
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (94)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)
Sur d’autres sites (8151)
-
How do I keep black areas black with ffmpeg ?
11 janvier 2018, par Aurelius SchnitzlerWhen encoding GoPro videos with ffmpeg using
ffmpeg -i Goprovideo.mp4 -pix_fmt yuv420p -vf scale=1920:-1,crop=1920:1080:0:362 Goprovideo-out.mp4
I noticed that the videos do not only get much smaller, but also in some cases do black areas lose intensity. So what was black is now grey. Not to an extreme, but slightly noticable.
How do I keep black areas black with ffmpeg ?
-
ffmpeg seek calculating wrong byte range ?
12 mars 2020, par user4455I’m running into an issue while trying to extract thumbnails from a movie file at a specific timestamp. Generally I’ve had no issues with this, but I’ve come across a set of movie files that are getting an error about the byte range requested (416 Requested Range Not Satisfiable).
The odd thing is that the server is correctly returning the content length in the partial content request, yet when it requests the movie file it requests a length that exceeds that.
This is a bit over my head, so I’m not sure what could be happening here. Any insight would be great.
The Command :
/usr/bin/ffmpeg -y -ss 1400 -i 'https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4' -qscale:v 2 -f image2 -vframes 1 -filter:v 'scale=192:108' -loglevel debug /data/www/storage/test.jpg 2>&1
The Error :
[https @ 0x22e1e00] header='HTTP/1.1 416 Requested Range Not Satisfiable'
[https @ 0x22e1e00] http_code=416
[https @ 0x22e1e00] HTTP error 416 Requested Range Not SatisfiableSource File Size :
1776706045 bytes
Source Content Duration :
2897.624271
Partial Content Request :
[https @ 0x22e1e00] header='HTTP/1.1 206 Partial Content'
[https @ 0x22e1e00] http_code=206
[https @ 0x22e1e00] header='x-amz-id-2: 4J1pgHExIUA0GxIxSBmGJjrRqliHbsIjXeuGzVfTlaaoVXbyZI5FQNma8fGaifcovkXfxJev5yU='
[https @ 0x22e1e00] header='x-amz-request-id: 78B3BDBB0356EF40'
[https @ 0x22e1e00] header='Date: Wed, 16 Dec 2015 23:51:29 GMT'
[https @ 0x22e1e00] header='x-amz-meta-content-length: 2898'
[https @ 0x22e1e00] header='x-amz-meta-cb-modifiedtime: Tue, 15 Dec 2015 17:59:51 GMT'
[https @ 0x22e1e00] header='Last-Modified: Wed, 16 Dec 2015 23:44:59 GMT'
[https @ 0x22e1e00] header='ETag: "6341a8022630667a8070a83575e542e7-27"'
[https @ 0x22e1e00] header='Accept-Ranges: bytes'
[https @ 0x22e1e00] header='Content-Range: bytes 0-1776706044/1776706045'
[https @ 0x22e1e00] header='Content-Type: video/mp4'
[https @ 0x22e1e00] header='Content-Length: 1776706045'
[https @ 0x22e1e00] header='Server: AmazonS3'
[https @ 0x22e1e00] header='Connection: close'FFmpeg Request :
request: GET /my-bucket/mymoviefile.mp4 HTTP/1.1
User-Agent: Lavf/56.25.101
Accept: */*
Range: bytes=1781732960-
Connection: close
Host: s3-us-west-2.amazonaws.com
Icy-MetaData: 1Entire Log :
# /usr/bin/ffmpeg -y -ss 1400 -i 'https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4' -qscale:v 2 -f image2 -vframes 1 -filter:v 'scale=192:108' -loglevel debug /data/www/storage/test.jpg 2>&1
ffmpeg version 2.6.4 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '1400'.
Reading option '-i' ... matched as input file with argument 'https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4'.
Reading option '-qscale:v' ... matched as option 'qscale' (use fixed quality scale (VBR)) with argument '2'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'image2'.
Reading option '-vframes' ... matched as option 'vframes' (set the number of video frames to output) with argument '1'.
Reading option '-filter:v' ... matched as option 'filter' (set stream filtergraph) with argument 'scale=192:108'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '/data/www/storage/test.jpg' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4.
Applying option ss (set the start time offset) with argument 1400.
Successfully parsed a group of options.
Opening an input file: https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4.
[https @ 0x22e1e00] request: GET /my-bucket/mymoviefile.mp4 HTTP/1.1
User-Agent: Lavf/56.25.101
Accept: */*
Range: bytes=0-
Connection: close
Host: s3-us-west-2.amazonaws.com
Icy-MetaData: 1
[https @ 0x22e1e00] header='HTTP/1.1 206 Partial Content'
[https @ 0x22e1e00] http_code=206
[https @ 0x22e1e00] header='x-amz-id-2: 4J1pgHExIUA0GxIxSBmGJjrRqliHbsIjXeuGzVfTlaaoVXbyZI5FQNma8fGaifcovkXfxJev5yU='
[https @ 0x22e1e00] header='x-amz-request-id: 78B3BDBB0356EF40'
[https @ 0x22e1e00] header='Date: Wed, 16 Dec 2015 23:51:29 GMT'
[https @ 0x22e1e00] header='x-amz-meta-content-length: 2898'
[https @ 0x22e1e00] header='x-amz-meta-cb-modifiedtime: Tue, 15 Dec 2015 17:59:51 GMT'
[https @ 0x22e1e00] header='Last-Modified: Wed, 16 Dec 2015 23:44:59 GMT'
[https @ 0x22e1e00] header='ETag: "6341a8022630667a8070a83575e542e7-27"'
[https @ 0x22e1e00] header='Accept-Ranges: bytes'
[https @ 0x22e1e00] header='Content-Range: bytes 0-1776706044/1776706045'
[https @ 0x22e1e00] header='Content-Type: video/mp4'
[https @ 0x22e1e00] header='Content-Length: 1776706045'
[https @ 0x22e1e00] header='Server: AmazonS3'
[https @ 0x22e1e00] header='Connection: close'
[https @ 0x22e1e00] header=''
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x22e1740] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x22e1740] ISO: File Type Major Brand: mp42
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x22e1740] Before avformat_find_stream_info() pos: 1647960 bytes read:1652200 seeks:0
[h264 @ 0x22e92c0] no picture
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x22e1740] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x22e1740] After avformat_find_stream_info() pos: 1862326 bytes read:1878504 seeks:0 frames:16
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: isommp41avc1
creation_time : 2015-11-18 02:34:41
Duration: 00:48:17.70, start: 0.000000, bitrate: 4905 kb/s
Stream #0:0(und), 15, 1/2997: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 1001/60000, 9994 kb/s, 29.97 fps, 29.97 tbr, 2997 tbn, 59.94 tbc (default)
Metadata:
creation_time : 2015-11-18 02:34:41
handler_name : ?Apple Video Media Handler
Stream #0:1(und), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
creation_time : 2015-11-18 02:34:41
handler_name : ?Apple Sound Media Handler
Successfully opened the file.
Parsing a group of options: output file /data/www/storage/test.jpg.
Applying option qscale:v (use fixed quality scale (VBR)) with argument 2.
Applying option f (force format) with argument image2.
Applying option vframes (set the number of video frames to output) with argument 1.
Applying option filter:v (set stream filtergraph) with argument scale=192:108.
Successfully parsed a group of options.
Opening an output file: /data/www/storage/test.jpg.
Successfully opened the file.
detected 2 logical cores
[Parsed_scale_0 @ 0x22cd4c0] Setting 'w' to value '192'
[Parsed_scale_0 @ 0x22cd4c0] Setting 'h' to value '108'
[Parsed_scale_0 @ 0x22cd4c0] Setting 'flags' to value '0x4'
[Parsed_scale_0 @ 0x22cd4c0] w:192 h:108 flags:'0x4' interl:0
[graph 0 input from stream 0:0 @ 0x22ccfe0] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 0x22ccfe0] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x22ccfe0] Setting 'time_base' to value '1/2997'
[graph 0 input from stream 0:0 @ 0x22ccfe0] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x22ccfe0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x22ccfe0] Setting 'frame_rate' to value '2997/100'
[graph 0 input from stream 0:0 @ 0x22ccfe0] w:1920 h:1080 pixfmt:yuv420p tb:1/2997 fr:2997/100 sar:1/1 sws_param:flags=2
[format @ 0x2798640] compat: called with args=[yuvj420p|yuvj422p|yuvj444p]
[format @ 0x2798640] Setting 'pix_fmts' to value 'yuvj420p|yuvj422p|yuvj444p'
[AVFilterGraph @ 0x22cda60] query_formats: 5 queried, 4 merged, 0 already done, 0 delayed
[Parsed_scale_0 @ 0x22cd4c0] picking yuvj420p out of 3 ref:yuv420p alpha:0
[swscaler @ 0x22c3c80] deprecated pixel format used, make sure you did set range correctly
[Parsed_scale_0 @ 0x22cd4c0] w:1920 h:1080 fmt:yuv420p sar:1/1 -> w:192 h:108 fmt:yuvj420p sar:1/1 flags:0x4
[mjpeg @ 0x2854e20] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x28716c0] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x2795320] intra_quant_bias = 96 inter_quant_bias = 0
Output #0, image2, to '/data/www/storage/test.jpg':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: isommp41avc1
encoder : Lavf56.25.101
Stream #0:0(und), 0, 100/2997: Video: mjpeg, yuvj420p(pc, left), 192x108 [SAR 1:1 DAR 16:9], 100/2997, q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
Metadata:
creation_time : 2015-11-18 02:34:41
handler_name : ?Apple Video Media Handler
encoder : Lavc56.26.100 mjpeg
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[https @ 0x22e1e00] request: GET /my-bucket/mymoviefile.mp4 HTTP/1.1
User-Agent: Lavf/56.25.101
Accept: */*
Range: bytes=1781732960-
Connection: close
Host: s3-us-west-2.amazonaws.com
Icy-MetaData: 1
[https @ 0x22e1e00] header='HTTP/1.1 416 Requested Range Not Satisfiable'
[https @ 0x22e1e00] http_code=416
[https @ 0x22e1e00] HTTP error 416 Requested Range Not Satisfiable
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x22e1740] stream 0, offset 0x6a331660: partial file
https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4: Invalid data found when processing input
[output stream 0:0 @ 0x22d7500] EOF on sink link output stream 0:0:default.
No more output streams to write to, finishing.
frame= 0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4):
Input stream #0:0 (video): 0 packets read (0 bytes); 0 frames decoded;
Input stream #0:1 (audio): 0 packets read (0 bytes);
Total: 0 packets (0 bytes) demuxed
Output file #0 (/data/www/storage/test.jpg):
Output stream #0:0 (video): 0 frames encoded; 0 packets muxed (0 bytes);
Total: 0 packets (0 bytes) muxed
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x27ab100] Statistics: 1878504 bytes read, 0 seeksFFprobe Result :
# /usr/bin/ffprobe -show_format -show_streams -i 'https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4'
ffprobe version 2.6.4 Copyright (c) 2007-2015 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: isommp41avc1
creation_time : 2015-11-18 02:34:41
Duration: 00:48:17.70, start: 0.000000, bitrate: 4905 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 9994 kb/s, 29.97 fps, 29.97 tbr, 2997 tbn, 59.94 tbc (default)
Metadata:
creation_time : 2015-11-18 02:34:41
handler_name : ?Apple Video Media Handler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
creation_time : 2015-11-18 02:34:41
handler_name : ?Apple Sound Media Handler
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1001/60000
codec_tag_string=avc1
codec_tag=0x31637661
width=1920
height=1080
has_b_frames=1
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=40
color_range=tv
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
timecode=N/A
refs=3
is_avc=1
nal_length_size=4
id=N/A
r_frame_rate=2997/100
avg_frame_rate=2997/100
time_base=1/2997
start_pts=0
start_time=0.000000
duration_ts=8684300
duration=2897.664331
bit_rate=9994429
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=86843
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:creation_time=2015-11-18 02:34:41
TAG:language=und
TAG:handler_name=Apple Video Media Handler
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/48000
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=139085965
duration=2897.624271
bit_rate=192002
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=135828
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:creation_time=2015-11-18 02:34:41
TAG:language=und
TAG:handler_name=Apple Sound Media Handler
[/STREAM]
[FORMAT]
filename=https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4
nb_streams=2
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=2897.695000
size=1776706045
bit_rate=4905156
probe_score=100
TAG:major_brand=mp42
TAG:minor_version=1
TAG:compatible_brands=isommp41avc1
TAG:creation_time=2015-11-18 02:34:41
[/FORMAT] -
FFMPEG process Killed and raises returncode 137 when executed through python3 subprocess.Popen but runs fine from the command line
22 novembre 2017, par Stuart ClarkeI’m not sure if this is the best way to go about this, but I have another question here which I don’t think was asked very well (or more to the point I realised the actual problem and have a simpler way of asking for help). If you can answer this question you’ll have the answer to the other.
I’m using
python 3.5.2
andffmpeg 3.3.4-2
and have this function to run myffmpeg
commands :def ffmpegPro(args):
err = None
for i, arg in enumerate(args):
if(" " in arg or "(" in arg or "[" in arg):
args[i] = "\"" + arg + "\""
command = [
ffmpegcmd, '-y',
'-loglevel', loglevel
] + args
commandStr = " ".join(command)
ffmpeg = subprocess.Popen(commandStr, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True, shell=True)
out, err = ffmpeg.communicate()
if ffmpeg.returncode != 0:
print(commandStr + "\n" + "ERROR CODE: " + str(ffmpeg.returncode))
raise Exception(err)When I pass the following
args
thereturncode
is137
and the process isKilled
. This only occurs when executed inpython
, when I run the same command at thecommand line
it executes as expected.['-i', '/var/www/temp/film.mp4', '-vf', 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black', '/var/www/temp/videoHD.mp4']
The resulting command is :
ffmpeg -y -loglevel verbose -i /var/www/temp/film.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black" /var/www/temp/videoHD.mp4
When executed through
python
:ERROR CODE: 137
Traceback (most recent call last):
File "getInsta2.py", line 740, in <module>
populate(media_feed, last, saved)
File "getInsta2.py", line 679, in populate
videoPost(media, hasVids, thisSaved)
File "getInsta2.py", line 639, in videoPost
processVideo(film, final, noMusic, audios, lengths)
File "getInsta2.py", line 358, in processVideo
ffmpegPro(args)
File "getInsta2.py", line 170, in ffmpegPro
raise Exception(err)
Exception: ffmpeg version 3.3.4-2~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version='2~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[h264 @ 0x7fa3db55a560] Reinit context to 640x368, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/temp/film.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Duration: 00:06:19.80, start: 0.000000, bitrate: 451 kb/s
Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x358 (640x368), 313 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x7fa3db59c700] Reinit context to 640x368, pix_fmt: yuv420p
[graph_1_in_0_1 @ 0x7fa3db7115e0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[Parsed_scale_0 @ 0x7fa3db72e000] w:1920 h:1080 flags:'bicubic' interl:0
[graph 0 input from stream 0:0 @ 0x7fa3db72f6a0] w:640 h:358 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:0/1 sws_param:flags=2
[Parsed_scale_0 @ 0x7fa3db72e000] w:640 h:358 fmt:yuv420p sar:0/1 -> w:1920 h:1074 fmt:yuv420p sar:0/1 flags:0x4
[Parsed_pad_1 @ 0x7fa3db72eac0] w:1920 h:1074 -> w:1920 h:1080 x:0 y:2 color:0x000000FF
[libx264 @ 0x7fa3db7309e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fa3db7309e0] profile High, level 4.0
[libx264 @ 0x7fa3db7309e0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/var/www/temp/videoHD.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Stream #0:0(und): Video: h264 (libx264), 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.89.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.89.100 aac
Killed
</module>Note the
Killed
at the end. This occurs just before any processing begins.BUT when run from the
command line
(cutting and pasting the command as outputted by the code) we get :ffmpeg version 3.3.4-2~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version='2~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[h264 @ 0x7f68c918f560] Reinit context to 640x368, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/temp/film.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Duration: 00:06:19.80, start: 0.000000, bitrate: 451 kb/s
Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x358 (640x368), 313 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x7f68c91d1700] Reinit context to 640x368, pix_fmt: yuv420p
[graph_1_in_0_1 @ 0x7f68c93465e0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[Parsed_scale_0 @ 0x7f68c9363000] w:1920 h:1080 flags:'bicubic' interl:0
[graph 0 input from stream 0:0 @ 0x7f68c93646a0] w:640 h:358 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:0/1 sws_param:flags=2
[Parsed_scale_0 @ 0x7f68c9363000] w:640 h:358 fmt:yuv420p sar:0/1 -> w:1920 h:1074 fmt:yuv420p sar:0/1 flags:0x4
[Parsed_pad_1 @ 0x7f68c9363ac0] w:1920 h:1074 -> w:1920 h:1080 x:0 y:2 color:0x000000FF
[libx264 @ 0x7f68c93659e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7f68c93659e0] profile High, level 4.0
[libx264 @ 0x7f68c93659e0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/var/www/temp/videoHD.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Stream #0:0(und): Video: h264 (libx264), 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.89.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.89.100 aac
frame= 46 fps=0.0 q=0.0 size= 0kB time=00:00:01.62 bitrate= 0.0kbits/s
frame= 59 fps= 46 q=29.0 size= 116kB time=00:00:02.04 bitrate= 464.8kbits/
frame= 72 fps= 40 q=29.0 size= 203kB time=00:00:02.49 bitrate= 667.2kbits/
frame= 84 fps= 36 q=29.0 size= 308kB time=00:00:02.88 bitrate= 875.9kbits/
Blah
Blah
Blah
frame=11351 fps= 21 q=26.0 size= 97572kB time=00:06:18.45 bitrate=2112.1kbits/
frame=11367 fps= 21 q=29.0 size= 97732kB time=00:06:18.98 bitrate=2112.5kbits/
frame=11384 fps= 22 q=29.0 size= 97809kB time=00:06:19.56 bitrate=2111.0kbits/
No more output streams to write to, finishing.
frame=11392 fps= 21 q=-1.0 Lsize= 98519kB time=00:06:19.77 bitrate=2125.1kbits/s speed=0.715x
video:92124kB audio:5986kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.416313%
Input file #0 (/var/www/temp/film.mp4):
Input stream #0:0 (video): 11392 packets read (14892948 bytes); 11392 frames decoded;
Input stream #0:1 (audio): 17803 packets read (6112540 bytes); 17802 frames decoded (18229248 samples);
Total: 29195 packets (21005488 bytes) demuxed
Output file #0 (/var/www/temp/videoHD.mp4):
Output stream #0:0 (video): 11392 frames encoded; 11392 packets muxed (94334785 bytes);
Output stream #0:1 (audio): 17802 frames encoded (18229248 samples); 17803 packets muxed (6129981 bytes);
Total: 29195 packets (100464766 bytes) muxed
[libx264 @ 0x7f68c93659e0] frame I:74 Avg QP:19.08 size: 51540
[libx264 @ 0x7f68c93659e0] frame P:3506 Avg QP:21.34 size: 19348
[libx264 @ 0x7f68c93659e0] frame B:7812 Avg QP:24.07 size: 2904
[libx264 @ 0x7f68c93659e0] consecutive B-frames: 1.3% 20.2% 4.6% 73.9%
[libx264 @ 0x7f68c93659e0] mb I I16..4: 19.7% 73.6% 6.7%
[libx264 @ 0x7f68c93659e0] mb P I16..4: 3.2% 6.4% 0.1% P16..4: 52.5% 7.6% 2.6% 0.0% 0.0% skip:27.6%
[libx264 @ 0x7f68c93659e0] mb B I16..4: 0.2% 0.2% 0.0% B16..8: 23.2% 0.4% 0.0% direct: 0.5% skip:75.5% L0:51.8% L1:46.6% BI: 1.6%
[libx264 @ 0x7f68c93659e0] 8x8 transform intra:66.4% inter:94.0%
[libx264 @ 0x7f68c93659e0] coded y,uvDC,uvAC intra: 33.6% 53.4% 7.3% inter: 5.3% 14.2% 0.0%
[libx264 @ 0x7f68c93659e0] i16 v,h,dc,p: 22% 27% 5% 46%
[libx264 @ 0x7f68c93659e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 19% 20% 4% 7% 7% 7% 5% 4%
[libx264 @ 0x7f68c93659e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 28% 11% 3% 9% 7% 6% 3% 2%
[libx264 @ 0x7f68c93659e0] i8c dc,h,v,p: 49% 21% 20% 10%
[libx264 @ 0x7f68c93659e0] Weighted P-Frames: Y:0.5% UV:0.1%
[libx264 @ 0x7f68c93659e0] ref P L0: 63.4% 8.9% 21.4% 6.3% 0.0%
[libx264 @ 0x7f68c93659e0] ref B L0: 89.3% 9.1% 1.6%
[libx264 @ 0x7f68c93659e0] ref B L1: 98.1% 1.9%
[libx264 @ 0x7f68c93659e0] kb/s:1987.38
[aac @ 0x7f68c9366e80] Qavg: 1160.814and the output video is fine.
Why would this process be killed by python ?
Thanks,
Stu