Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (21)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans 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 (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Encodage et transformation en formats lisibles sur Internet

    10 avril 2011

    MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
    Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
    Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...)

Sur d’autres sites (4868)

  • How to copy ffprobe dumped metadata to a converted video

    23 mai 2020, par Quer

    I hope you're all doing safe ! I'm using windows 10 and have lots of home videos, some of them are on .AVI format. I just discovered google photos don't backup .AVI videos, I tried converting it with GUI converters (FormatFactory, Wondershare, HandBrake) but when I tried to back it up, it wasn't preserving the metadata of my newly converted videos.

    



    I tried further research on this matter and I stumble upon ffmpeg (w/c the GUIs were using). I successfully converted .MOV while preserving metadata using :

    



    ffmpeg -i in.MOV -b:v 73000k -c:v libx264 -c:a aac -strict -2 -map_metadata 0 out.mp4


    



    but when I tried converting .AVI videos, with the command above, it doesn't retain the original metadata for the out.mp4.

    



    I tried another approach and I found out a method of dumping the metadata on a .txt then restoring it on the out.mp4.

    



    ffprobe -v error -show_format -show_streams DSCF0421.AVI > output.txt 2>&1


    



    The command above does save it on the output.txt

    



    output.txt


[STREAM]
index=0
codec_name=mjpeg
codec_long_name=Motion JPEG
profile=Baseline
codec_type=video
codec_time_base=33333/1000000
codec_tag_string=MJPG
codec_tag=0x47504a4d
width=640
height=480
coded_width=640
coded_height=480
closed_captions=0
has_b_frames=0
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
pix_fmt=yuvj422p
level=-99
color_range=pc
color_space=bt470bg
color_transfer=unknown
color_primaries=unknown
chroma_location=center
field_order=unknown
timecode=N/A
refs=1
id=N/A
r_frame_rate=1000000/33333
avg_frame_rate=1000000/33333
time_base=33333/1000000
start_pts=0
start_time=0.000000
duration_ts=150
duration=4.999950
bit_rate=9739922
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=150
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
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
DISPOSITION:timed_thumbnails=0
TAG:Make=FUJIFILM
TAG:Model=FinePix JX550
TAG:DateTime=2012:05:20 00:25:48
TAG:JPEGInterchangeFormat=    658
TAG:JPEGInterchangeFormatLength=   2698
TAG:Copyright=    
TAG:DateTimeOriginal=2012:05:20 00:25:48
TAG:DateTimeDigitized=2012:05:20 00:25:48
TAG:MakerNote=
 uwu
TAG:title=FUJIFILM AVI STREAM 0100
[/STREAM]
[STREAM]
index=1
codec_name=pcm_u8
codec_long_name=PCM unsigned 8-bit
profile=unknown
codec_type=audio
codec_time_base=1/11024
codec_tag_string=[1][0][0][0]
codec_tag=0x0001
sample_fmt=u8
sample_rate=11024
channels=1
channel_layout=unknown
bits_per_sample=8
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/11024
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=88192
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=55120
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
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
DISPOSITION:timed_thumbnails=0
[/STREAM]
[FORMAT]
filename=DSCF0421.AVI
nb_streams=2
nb_programs=0
format_name=avi
format_long_name=AVI (Audio Video Interleaved)
start_time=0.000000
duration=4.999950
size=6111800
bit_rate=9778977
probe_score=100
[/FORMAT]


    



    Then I tried restoring it with either .mp4 or .mkv

    



    MP4

ffmpeg -i DSCF0421.AVI -i output.txt compressed.mp4

MKV

ffmpeg -i DSCF0421.AVI -i output.txt compressed.mkv


    



    result of the command above :

    



    MP4

    



    C:\Users\PandaLabs\Desktop\Conversion underground>ffmpeg -i DSCF0421.AVI -i output.txt compressed.mp4
ffmpeg version git-2020-05-22-38490cb Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200513
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 46.100 / 56. 46.100
  libavcodec     58. 86.101 / 58. 86.101
  libavformat    58. 43.100 / 58. 43.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 82.100 /  7. 82.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, avi, from 'DSCF0421.AVI':
  Duration: 00:00:05.00, start: 0.000000, bitrate: 9778 kb/s
    Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 640x480, 9739 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
    Metadata:
      Make            : FUJIFILM
      Model           : FinePix JX550
      DateTime        : 2012:05:20 00:25:48
      JPEGInterchangeFormat:     658
      JPEGInterchangeFormatLength:    2698
      Copyright       :
      DateTimeOriginal: 2012:05:20 00:25:48
      DateTimeDigitized: 2012:05:20 00:25:48
      MakerNote       :
                      :  70,  85,  74,  73,  70,  73,  76,  77,  12,   0,   0,   0,  18,   0,   0,   0
                      :   7,   0,   4,   0,   0,   0,  48,  49,  51,  48,  16,   0,   2,   0,  33,   0
                      :   0,   0,   2,   1,   0,   0,   0,  16,   2,   0,   8,   0,   0,   0,  35,   1
                      :   0,   0,   1,  16,   3,   0,   1,   0,   0,   0,   3,   0,   0,   0,   2,  16
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  16,  16,   3,   0,   1,   0
                      :   0,   0,   2,   0,   0,   0,  17,  16,  10,   0,   1,   0,   0,   0,  43,   1
                      :   0,   0,  32,  16,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  33,  16
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  48,  16,   3,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,  49,  16,   3,   0,   1,   0,   0,   0,   0,   0
                      :   0,   0,   0,  17,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,  18
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,  19,   3,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,   1,  19,   3,   0,   1,   0,   0,   0,   0,   0
                      :   0,   0,   2,  19,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  48,  20
                      :   7,   0, 129,   0,   0,   0,  52,   1,   0,   0,  49,  20,   4,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,  53,  57,  50,  68,  51,  49,  51,  49,  51,  57,  51,  54,  51,  49
                      :  49,  50,  48,  51,  49,  56,  70,  70,  69,  53,  50,  83,  80,  48,  52,  54
                      :  50,  54,   0,  78,  79,  82,  77,  65,  76,  32,   0,   0,   0,   0,   0, 100
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0
      title           : FUJIFILM AVI STREAM 0100
    Stream #0:1: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 11024 Hz, mono, u8, 88 kb/s
Input #1, tty, from 'output.txt':
  Duration: 00:00:00.80, start: 0.000000, bitrate: 46 kb/s
    Stream #1:0: Video: ansi, pal8, 640x400, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_u8 (native) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0000017c4ae758c0] Too many bits 6408.707483 > 6144 per frame requested, clamping to max
[libx264 @ 0000017c4ae65440] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000017c4ae65440] profile High 4:2:2, level 3.0, 4:2:2, 8-bit
[libx264 @ 0000017c4ae65440] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - 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=12 lookahead_threads=2 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 'compressed.mp4':
  Metadata:
    encoder         : Lavf58.43.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuvj422p(pc), 640x480, q=-1--1, 30 fps, 1000k tbn, 30 tbc
    Metadata:
      Make            : FUJIFILM
      Model           : FinePix JX550
      DateTime        : 2012:05:20 00:25:48
      JPEGInterchangeFormat:     658
      JPEGInterchangeFormatLength:    2698
      Copyright       :
      DateTimeOriginal: 2012:05:20 00:25:48
      DateTimeDigitized: 2012:05:20 00:25:48
      MakerNote       :
                      :  70,  85,  74,  73,  70,  73,  76,  77,  12,   0,   0,   0,  18,   0,   0,   0
                      :   7,   0,   4,   0,   0,   0,  48,  49,  51,  48,  16,   0,   2,   0,  33,   0
                      :   0,   0,   2,   1,   0,   0,   0,  16,   2,   0,   8,   0,   0,   0,  35,   1
                      :   0,   0,   1,  16,   3,   0,   1,   0,   0,   0,   3,   0,   0,   0,   2,  16
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  16,  16,   3,   0,   1,   0
                      :   0,   0,   2,   0,   0,   0,  17,  16,  10,   0,   1,   0,   0,   0,  43,   1
                      :   0,   0,  32,  16,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  33,  16
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  48,  16,   3,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,  49,  16,   3,   0,   1,   0,   0,   0,   0,   0
                      :   0,   0,   0,  17,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,  18
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,  19,   3,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,   1,  19,   3,   0,   1,   0,   0,   0,   0,   0
                      :   0,   0,   2,  19,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  48,  20
                      :   7,   0, 129,   0,   0,   0,  52,   1,   0,   0,  49,  20,   4,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,  53,  57,  50,  68,  51,  49,  51,  49,  51,  57,  51,  54,  51,  49
                      :  49,  50,  48,  51,  49,  56,  70,  70,  69,  53,  50,  83,  80,  48,  52,  54
                      :  50,  54,   0,  78,  79,  82,  77,  65,  76,  32,   0,   0,   0,   0,   0, 100
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0
      title           : FUJIFILM AVI STREAM 0100
      encoder         : Lavc58.86.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 11025 Hz, mono, fltp, 66 kb/s
    Metadata:
      encoder         : Lavc58.86.101 aac
[mjpeg @ 0000017c4ae70fc0] mjpeg_decode_dc: bad vlc: 0:0 (0000017c4ae71688)
[mjpeg @ 0000017c4ae70fc0] error dc
[mjpeg @ 0000017c4ae70fc0] error y=59 x=39
frame=  150 fps=104 q=-1.0 Lsize=    2327kB time=00:00:05.01 bitrate=3801.3kbits/s speed=3.49x
video:2290kB audio:33kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.175157%
[libx264 @ 0000017c4ae65440] frame I:2     Avg QP:25.35  size: 24876
[libx264 @ 0000017c4ae65440] frame P:38    Avg QP:26.87  size: 18472
[libx264 @ 0000017c4ae65440] frame B:110   Avg QP:27.42  size: 14477
[libx264 @ 0000017c4ae65440] consecutive B-frames:  1.3%  2.7%  0.0% 96.0%
[libx264 @ 0000017c4ae65440] mb I  I16..4:  0.2% 98.9%  0.9%
[libx264 @ 0000017c4ae65440] mb P  I16..4:  0.2% 54.8%  1.2%  P16..4: 29.1% 11.2%  3.4%  0.0%  0.0%    skip: 0.1%
[libx264 @ 0000017c4ae65440] mb B  I16..4:  0.0% 22.9%  0.1%  B16..8: 40.5% 14.0%  3.0%  direct:15.2%  skip: 4.3%  L0:45.5% L1:42.5% BI:12.0%
[libx264 @ 0000017c4ae65440] 8x8 transform intra:98.6% inter:79.9%
[libx264 @ 0000017c4ae65440] coded y,uvDC,uvAC intra: 92.1% 99.0% 74.7% inter: 60.8% 91.7% 25.7%
[libx264 @ 0000017c4ae65440] i16 v,h,dc,p: 26%  7% 12% 55%
[libx264 @ 0000017c4ae65440] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 10% 40%  6%  6%  6%  5%  7%  8%
[libx264 @ 0000017c4ae65440] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 11% 19% 10%  9% 10%  6%  8%  5%
[libx264 @ 0000017c4ae65440] i8c dc,h,v,p: 65%  7% 23%  5%
[libx264 @ 0000017c4ae65440] Weighted P-Frames: Y:2.6% UV:2.6%
[libx264 @ 0000017c4ae65440] ref P L0: 41.3% 11.9% 27.9% 18.5%  0.4%
[libx264 @ 0000017c4ae65440] ref B L0: 75.4% 19.4%  5.2%
[libx264 @ 0000017c4ae65440] ref B L1: 89.4% 10.6%
[libx264 @ 0000017c4ae65440] kb/s:3750.61
[aac @ 0000017c4ae758c0] Qavg: 27095.141


    



    MKV

    



    C:\Users\PandaLabs\Desktop\Conversion underground>ffmpeg -i DSCF0421.AVI -i output.txt compressed.mkv
ffmpeg version git-2020-05-22-38490cb Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200513
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 46.100 / 56. 46.100
  libavcodec     58. 86.101 / 58. 86.101
  libavformat    58. 43.100 / 58. 43.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 82.100 /  7. 82.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, avi, from 'DSCF0421.AVI':
  Duration: 00:00:05.00, start: 0.000000, bitrate: 9778 kb/s
    Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 640x480, 9739 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
    Metadata:
      Make            : FUJIFILM
      Model           : FinePix JX550
      DateTime        : 2012:05:20 00:25:48
      JPEGInterchangeFormat:     658
      JPEGInterchangeFormatLength:    2698
      Copyright       :
      DateTimeOriginal: 2012:05:20 00:25:48
      DateTimeDigitized: 2012:05:20 00:25:48
      MakerNote       :
                      :  70,  85,  74,  73,  70,  73,  76,  77,  12,   0,   0,   0,  18,   0,   0,   0
                      :   7,   0,   4,   0,   0,   0,  48,  49,  51,  48,  16,   0,   2,   0,  33,   0
                      :   0,   0,   2,   1,   0,   0,   0,  16,   2,   0,   8,   0,   0,   0,  35,   1
                      :   0,   0,   1,  16,   3,   0,   1,   0,   0,   0,   3,   0,   0,   0,   2,  16
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  16,  16,   3,   0,   1,   0
                      :   0,   0,   2,   0,   0,   0,  17,  16,  10,   0,   1,   0,   0,   0,  43,   1
                      :   0,   0,  32,  16,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  33,  16
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  48,  16,   3,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,  49,  16,   3,   0,   1,   0,   0,   0,   0,   0
                      :   0,   0,   0,  17,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,  18
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,  19,   3,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,   1,  19,   3,   0,   1,   0,   0,   0,   0,   0
                      :   0,   0,   2,  19,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  48,  20
                      :   7,   0, 129,   0,   0,   0,  52,   1,   0,   0,  49,  20,   4,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,  53,  57,  50,  68,  51,  49,  51,  49,  51,  57,  51,  54,  51,  49
                      :  49,  50,  48,  51,  49,  56,  70,  70,  69,  53,  50,  83,  80,  48,  52,  54
                      :  50,  54,   0,  78,  79,  82,  77,  65,  76,  32,   0,   0,   0,   0,   0, 100
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0
      title           : FUJIFILM AVI STREAM 0100
    Stream #0:1: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 11024 Hz, mono, u8, 88 kb/s
Input #1, tty, from 'output.txt':
  Duration: 00:00:00.80, start: 0.000000, bitrate: 46 kb/s
    Stream #1:0: Video: ansi, pal8, 640x400, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_u8 (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
[libx264 @ 000002b3674f3f40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000002b3674f3f40] profile High 4:2:2, level 3.0, 4:2:2, 8-bit
[libx264 @ 000002b3674f3f40] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - 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=12 lookahead_threads=2 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, matroska, to 'compressed.mkv':
  Metadata:
    encoder         : Lavf58.43.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuvj422p(pc), 640x480, q=-1--1, 30 fps, 1k tbn, 30 tbc
    Metadata:
      Make            : FUJIFILM
      Model           : FinePix JX550
      DateTime        : 2012:05:20 00:25:48
      JPEGInterchangeFormat:     658
      JPEGInterchangeFormatLength:    2698
      Copyright       :
      DateTimeOriginal: 2012:05:20 00:25:48
      DateTimeDigitized: 2012:05:20 00:25:48
      MakerNote       :
                      :  70,  85,  74,  73,  70,  73,  76,  77,  12,   0,   0,   0,  18,   0,   0,   0
                      :   7,   0,   4,   0,   0,   0,  48,  49,  51,  48,  16,   0,   2,   0,  33,   0
                      :   0,   0,   2,   1,   0,   0,   0,  16,   2,   0,   8,   0,   0,   0,  35,   1
                      :   0,   0,   1,  16,   3,   0,   1,   0,   0,   0,   3,   0,   0,   0,   2,  16
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  16,  16,   3,   0,   1,   0
                      :   0,   0,   2,   0,   0,   0,  17,  16,  10,   0,   1,   0,   0,   0,  43,   1
                      :   0,   0,  32,  16,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  33,  16
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  48,  16,   3,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,  49,  16,   3,   0,   1,   0,   0,   0,   0,   0
                      :   0,   0,   0,  17,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,  18
                      :   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,  19,   3,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,   1,  19,   3,   0,   1,   0,   0,   0,   0,   0
                      :   0,   0,   2,  19,   3,   0,   1,   0,   0,   0,   0,   0,   0,   0,  48,  20
                      :   7,   0, 129,   0,   0,   0,  52,   1,   0,   0,  49,  20,   4,   0,   1,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,  53,  57,  50,  68,  51,  49,  51,  49,  51,  57,  51,  54,  51,  49
                      :  49,  50,  48,  51,  49,  56,  70,  70,  69,  53,  50,  83,  80,  48,  52,  54
                      :  50,  54,   0,  78,  79,  82,  77,  65,  76,  32,   0,   0,   0,   0,   0, 100
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
                      :   0,   0,   0,   0,   0,   0
      title           : FUJIFILM AVI STREAM 0100
      encoder         : Lavc58.86.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 11024 Hz, mono, fltp
    Metadata:
      encoder         : Lavc58.86.101 libvorbis
[mjpeg @ 000002b3674f0fc0] mjpeg_decode_dc: bad vlc: 0:0 (000002b3674f1688)
[mjpeg @ 000002b3674f0fc0] error dc
[mjpeg @ 000002b3674f0fc0] error y=59 x=39
frame=  150 fps= 95 q=-1.0 Lsize=    2317kB time=00:00:04.99 bitrate=3797.5kbits/s speed=3.16x
video:2290kB audio:19kB subtitle:0kB other streams:0kB global headers:3kB muxing overhead: 0.355840%
[libx264 @ 000002b3674f3f40] frame I:2     Avg QP:25.35  size: 24876
[libx264 @ 000002b3674f3f40] frame P:38    Avg QP:26.87  size: 18472
[libx264 @ 000002b3674f3f40] frame B:110   Avg QP:27.42  size: 14477
[libx264 @ 000002b3674f3f40] consecutive B-frames:  1.3%  2.7%  0.0% 96.0%
[libx264 @ 000002b3674f3f40] mb I  I16..4:  0.2% 98.9%  0.9%
[libx264 @ 000002b3674f3f40] mb P  I16..4:  0.2% 54.8%  1.2%  P16..4: 29.1% 11.2%  3.4%  0.0%  0.0%    skip: 0.1%
[libx264 @ 000002b3674f3f40] mb B  I16..4:  0.0% 22.9%  0.1%  B16..8: 40.5% 14.0%  3.0%  direct:15.2%  skip: 4.3%  L0:45.5% L1:42.5% BI:12.0%
[libx264 @ 000002b3674f3f40] 8x8 transform intra:98.6% inter:79.9%
[libx264 @ 000002b3674f3f40] coded y,uvDC,uvAC intra: 92.1% 99.0% 74.7% inter: 60.8% 91.7% 25.7%
[libx264 @ 000002b3674f3f40] i16 v,h,dc,p: 26%  7% 12% 55%
[libx264 @ 000002b3674f3f40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 10% 40%  6%  6%  6%  5%  7%  8%
[libx264 @ 000002b3674f3f40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 11% 19% 10%  9% 10%  6%  8%  5%
[libx264 @ 000002b3674f3f40] i8c dc,h,v,p: 65%  7% 23%  5%
[libx264 @ 000002b3674f3f40] Weighted P-Frames: Y:2.6% UV:2.6%
[libx264 @ 000002b3674f3f40] ref P L0: 41.3% 11.9% 27.9% 18.5%  0.4%
[libx264 @ 000002b3674f3f40] ref B L0: 75.4% 19.4%  5.2%
[libx264 @ 000002b3674f3f40] ref B L1: 89.4% 10.6%
[libx264 @ 000002b3674f3f40] kb/s:3750.61


    



    It doesn't successfully restore the metadata of the source .AVI

    



    BTW, I don't intend to shrink the size of the video I just need to retain its created date and some miscellaneous.

    



    Thank you in advance for those who will answer !

    


  • Unplayable video after running FFmpeg command

    25 mai 2020, par HB.

    I asked this question last year. I resolved the issue I had and I implemented the same logic for merging an image with a video, instead of two images. This is running on Android.

    



    Here is the command I'm using currently :

    



    "-i", mFilePath, "-i", drawingPath, "-filter_complex", "[0:v]scale=iw*sar:ih,setsar=1,pad='max(iw\\,2*trunc(ih*47/80/2))':'max(ih\\,2*trunc(ow*80/47/2))':(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-map", "0:a", "-c:v", "libx264", "-preset", "ultrafast", "-r", outputFPS, outputPath}


    



    47/80/2 is calculated by getting a device's screen dimensions - 1128 x 1920.

    



    When running this on certain devices, it results in an unplayable video.

    



    But running the following command works perfectly fine :

    



    "-i", mFilePath, "-crf", "18", "-c:v", "libx264", "-preset", "ultrafast", outputPath};


    



    I think the issue is with the filter being applied ?

    




    



    I compared running the first command on two different devices.

    



      

    • On the first device (Samsung J7 Pro), I was able to run the command successfully and play the video afterward. I tested the output on both devices and it is working.
    • 


    • On the second device (Sony Xperia Tablet Z), I was able to run the command successfully but could not play the video. I tested the output on both devices and it doesn't play on either. It does play on my computer.
    • 


    



    I compared the original video with the one not working and the one without a filter and the only difference I could find is that the one that is not working profile is Baseline@L4.2 and the one without a filter profile is Baseline@L4.0. The original video profile is High@L4.0.

    



    Here are all the videos. The original, the one without a filter (working) and the one with the filter(no working).

    



    I have no idea why this is happening ? Any help would be appreciated.

    




    



    Edit 1 :

    



    Here is the actual log as requested :

    



    "-i", "/storage/emulated/0/Android/data/com.my.package/files/CameraTemp/2020_05_24_09_17_53.mp4", "-i", "/storage/emulated/0/Android/data/com.my.package/files/MyVideos/tempShapes.png", "-filter_complex", "[0:v]scale=iw*sar:ih,setsar=1,pad='max(iw\\,2*trunc(ih*47/80/2))':'max(ih\\,2*trunc(ow*80/47/2))':(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-map", "0:a", "-c:v", "libx264", "-preset", "ultrafast", "-r", "30", "/storage/emulated/0/Android/data/com.my.package/files/MyVideos/video with line.mp4"


    



    and here is the complete log :

    



    ffmpeg version n4.0-39-gda39990 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 4.9.x (GCC) 20150123 (prerelease)
  configuration: --target-os=linux --cross-prefix=/root/bravobit/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/bravobit/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-ffprobe --enable-libopus --enable-libvorbis --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-libvpx --enable-libass --enable-yasm --enable-pthreads --disable-debug --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-linux-perf --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --enable-nonfree --enable-network --enable-avresample --enable-avformat --enable-avcodec --enable-indev=lavfi --enable-hwaccels --enable-ffmpeg --enable-zlib --enable-gpl --enable-small --enable-nonfree --pkg-config=pkg-config --pkg-config-flags=--static --prefix=/root/bravobit/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/bravobit/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/bravobit/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-cxxflags=
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Android/data/com.my.package/files/CameraTemp/2020_05_24_09_17_53.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2020-05-24T08:18:02.000000Z
  Duration: 00:00:01.64, start: 0.000000, bitrate: 20750 kb/s
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080, 18056 kb/s, SAR 1:1 DAR 16:9, 29.70 fps, 29.67 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2020-05-24T08:18:02.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 155 kb/s (default)
    Metadata:
      creation_time   : 2020-05-24T08:18:02.000000Z
      handler_name    : SoundHandle
Input #1, png_pipe, from '/storage/emulated/0/Android/data/com.my.package/files/MyVideos/tempShapes.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 1920x1128, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (h264) -> scale (graph 0)
  Stream #1:0 (png) -> scale2ref:default (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
[libx264 @ 0xb83fc8a0] using SAR=1/1
[libx264 @ 0xb83fc8a0] using cpu capabilities: ARMv6 NEON
[libx264 @ 0xb83fc8a0] profile Constrained Baseline, level 4.2
[libx264 @ 0xb83fc8a0] 264 - core 152 r2851M ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=2 keyint_min=1 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to '/storage/emulated/0/Android/data/com.my.package/files/MyVideos/video with line.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1128 [SAR 1:1 DAR 80:47], q=-1--1, 29 fps, 14848 tbn, 29 tbc (default)
    Metadata:
      encoder         : Lavc58.18.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2020-05-24T08:18:02.000000Z
      handler_name    : SoundHandle
      encoder         : Lavc58.18.100 aac
frame=    1 fps=0.4 q=0.0 size=       0kB time=00:00:01.01 bitrate=   0.4kbits/s speed=0.397x    
frame=    5 fps=1.6 q=0.0 size=       0kB time=00:00:01.01 bitrate=   0.4kbits/s speed=0.33x    
frame=    9 fps=2.5 q=24.0 size=     256kB time=00:00:01.01 bitrate=2075.0kbits/s speed=0.28x    
frame=   13 fps=3.1 q=25.0 size=    1024kB time=00:00:01.01 bitrate=8298.9kbits/s speed=0.243x    
frame=   18 fps=3.8 q=29.0 size=    2048kB time=00:00:01.01 bitrate=16597.5kbits/s speed=0.214x    
frame=   21 fps=3.9 q=25.0 size=    2560kB time=00:00:01.01 bitrate=20746.7kbits/s speed=0.19x    
frame=   23 fps=3.9 q=25.0 size=    2816kB time=00:00:01.01 bitrate=22821.4kbits/s speed=0.173x    
frame=   26 fps=4.0 q=29.0 size=    3584kB time=00:00:01.01 bitrate=29045.3kbits/s speed=0.156x    
Past duration 0.617577 too large
Past duration 0.639641 too large
frame=   28 fps=3.9 q=29.0 size=    3840kB time=00:00:01.01 bitrate=31119.9kbits/s speed=0.142x    
Past duration 0.665230 too large
frame=   29 fps=3.8 q=25.0 size=    3840kB time=00:00:01.01 bitrate=31119.9kbits/s speed=0.132x    
Past duration 0.690834 too large
Past duration 0.711281 too large
Past duration 0.736885 too large
frame=   32 fps=3.9 q=29.0 size=    4608kB time=00:00:01.01 bitrate=37343.8kbits/s speed=0.123x    
Past duration 0.762474 too large
Past duration 0.783577 too large
Past duration 0.807564 too large
frame=   35 fps=3.9 q=25.0 size=    4864kB time=00:00:01.01 bitrate=39418.4kbits/s speed=0.112x    
Past duration 0.831551 too large
Past duration 0.855537 too large
frame=   37 fps=3.5 q=25.0 size=    5376kB time=00:00:01.01 bitrate=43567.7kbits/s speed=0.0968x    
Past duration 0.879524 too large
Past duration 0.903511 too large
frame=   39 fps=3.4 q=25.0 size=    5376kB time=00:00:01.06 bitrate=41196.6kbits/s speed=0.0927x    
Past duration 0.927498 too large
Past duration 0.951500 too large
frame=   41 fps=3.4 q=25.0 size=    5376kB time=00:00:01.13 bitrate=38700.0kbits/s speed=0.0931x    
frame=   41 fps=3.2 q=25.0 size=    5376kB time=00:00:01.13 bitrate=38700.0kbits/s speed=0.0886x    
frame=   41 fps=3.1 q=25.0 size=    5888kB time=00:00:01.43 bitrate=33554.2kbits/s speed=0.108x    
Past duration 0.975487 too large
frame=   45 fps=3.2 q=26.0 size=    6656kB time=00:00:01.60 bitrate=33905.4kbits/s speed=0.114x    
frame=   45 fps=3.0 q=-1.0 Lsize=    8158kB time=00:00:01.65 bitrate=40480.7kbits/s speed=0.11x    
video:8127kB audio:28kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.032895%
[libx264 @ 0xb83fc8a0] frame I:23    Avg QP:24.70  size:337646
[libx264 @ 0xb83fc8a0] frame P:22    Avg QP:29.00  size: 25250
[libx264 @ 0xb83fc8a0] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0xb83fc8a0] mb P  I16..4:  0.4%  0.0%  0.0%  P16..4: 43.6%  0.0%  0.0%  0.0%  0.0%    skip:56.0%
[libx264 @ 0xb83fc8a0] coded y,uvDC,uvAC intra: 90.0% 84.7% 58.1% inter: 20.1% 6.2% 0.1%
[libx264 @ 0xb83fc8a0] i16 v,h,dc,p: 25% 28% 28% 20%
[libx264 @ 0xb83fc8a0] i8c dc,h,v,p: 39% 25% 20% 16%
[libx264 @ 0xb83fc8a0] kb/s:42901.20
[aac @ 0xb83d7d10] Qavg: 3517.779


    


  • error when add arabic text to video ffmpeg c#

    28 décembre 2020, par Fath Bakri

    i want to add Arabic annotation or text to video, i use ffmpeg version 4.3.1 in win 32 bit, here my code in c# :

    


    private string AddVideo_Annotation(string text,int X,int Y)
        {
            try
            {

                string FFmpegPath = Utils.GetEXE_FFmpegPath();
                string path = Utils.GetProgramPath();
                //store outcome of process
                var errors = new StringBuilder();
                var output = new StringBuilder();
                var hadErrors = false;

                Process pdfprocess = new Process();

                
                //pdfprocess.StartInfo.LoadUserProfile = true;
                pdfprocess.StartInfo.RedirectStandardOutput = true;
                pdfprocess.StartInfo.RedirectStandardError = true;
                pdfprocess.StartInfo.UseShellExecute = false;
                
                pdfprocess.StartInfo.FileName = FFmpegPath;
                //text_shaping=1
                pdfprocess.StartInfo.Arguments = "-i \""+filePath+ "\" -vf -enable-libfribidi drawtext=\"text_shaping=1:text=\'" + text+ "\':x=" + X+":y="+Y+ ":fontsize=24:fontcolor=Red\"  -c:a copy \"" + path + "\\out.mp4\"";
               
                //pdfprocess.StartInfo.WorkingDirectory = @"C:\Program Files\LibreOffice\program\";
                pdfprocess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

                pdfprocess.EnableRaisingEvents = true;

                // capture normal output
                pdfprocess.OutputDataReceived += (s, d) => {
                    output.Append(d.Data);
                };

                // Capture error output
                pdfprocess.ErrorDataReceived += (s, d) => {
                    if (!hadErrors)
                    {
                        hadErrors = !String.IsNullOrEmpty(d.Data);
                    }
                    errors.Append(d.Data);
                };
                pdfprocess.Start();
                pdfprocess.BeginErrorReadLine();
                pdfprocess.BeginOutputReadLine();
                try
                {
                    while (pdfprocess.MainWindowHandle == IntPtr.Zero)
                    {
                        // Discard cached information about the process
                        // because MainWindowHandle might be cached.
                        pdfprocess.Refresh();
                        
                        Thread.Sleep(200);

                    }
                }
                catch { }
                Thread.Sleep(2000);
                pdfprocess.WaitForExit();
                while ((Process.GetProcessesByName("ffmpeg").Length > 0))
                {
                    Thread.Sleep(200);
                }


                string stderr = errors.ToString();

                if (pdfprocess.ExitCode != 0)
                {
                    //MessageBox.Show("error:" + stderr);

                    throw new Exception("FFmpeg.exe has exit wit code " + pdfprocess.ExitCode+"\n"+ stderr);
                }
                return path + "\\out"+new FileInfo( filePath).Extension;
            }
            catch(Exception ex)
            {
                TXT_AnnotationText.Text = ex.Message + "\n" + ex.StackTrace.ToString();
                MessageBox.Show(ex.Message + "\n" + ex.StackTrace.ToString());
                throw ex;
            }
        }



    


    i get this error message :

    
FFmpeg.exe has exit wit code 1
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 10.2.1 (GCC) 20200726 configuration : —enable-gpl —enable-version3 —enable-sdl2 —enable-fontconfig —enable-gnutls —enable-iconv —enable-libass —enable-libdav1d —enable-libbluray —enable-libfreetype —enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libopenjpeg —enable-libopus —enable-libshine —enable-libsnappy —enable-libsoxr —enable-libsrt —enable-libtheora —enable-libtwolame —enable-libvpx —enable-libwavpack —enable-libwebp —enable-libx264 —enable-libx265 —enable-libxml2 —enable-libzimg —enable-lzma —enable-zlib —enable-gmp —enable-libvidstab —enable-libvmaf —enable-libvorbis —enable-libvo-amrwbenc —enable-libmysofa —enable-libspeex —enable-libxvid —enable-libaom —enable-libgsm —disable-w32threads —enable-libmfx —enable-ffnvcodec —enable-cuda-llvm —enable-cuvid —enable-d3d11va —enable-nvenc —enable-nvdec —enable-dxva2 —enable-avisynth —enable-libopenmpt —enable-amf libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D :\a.mp4' : Metadata : major_brand : mp42 minor_version : 0 compatible_brands : isommp42 creation_time : 2020-12-02T01:57:02.000000Z Duration : 00:01:37.70, start : 0.000000, bitrate : 125 kb/s Stream #0:0(eng) : Video : h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x662 [SAR 1:1 DAR 640:331], 124 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default) Metadata : creation_time : 2020-12-02T01:57:03.000000Z handler_name : Mainconcept MP4 Video Media Handler encoder : AVC Coding[NULL @ 05d306c0] Unable to find a suitable output format for 'drawtext=text_shaping=1:text='ظٹظ„ظٹظٹظ„ ظٹظ„ظٹط¨ظ„':x=200:y=200:fontsize=24:fontcolor=Red'drawtext=text_shaping=1:text='ظٹظ„ظٹظٹظ„ ظٹظ„ظٹط¨ظ„':x=200:y=200:fontsize=24:fontcolor=Red : Invalid argument
at EasyWhatsappSender.UserControls.UControl_VideoAudioPreview_Annotation.AddVideo_Annotation(String text, Int32 X, Int32 Y) in C :\Users\FathBakri\Documents\Visual Studio 2017\Projects\MediaViewer\UserControls\UControl_VideoAudioPreview_Annotation.cs:line 239

    
the error happen when i use text_shaping=1 , if i omit it and use Arabic text it display in symbols and not correct
how to fix it. Thanks for help