Recherche avancée

Médias (91)

Autres articles (85)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (6125)

  • Getting small file size from ffmpeg [duplicate]

    20 février 2020, par sukach

    I am not an ffmpeg expert. I am trying to get some movies converted to a smaller DIVX file for a cheap portable DVD player for a family trip. The movies are for my kids so I’m not too concerned about quality.

    The DVD player is a 10.1", 1024x600 screen. It says it supports DIVX/MPEG2 files. It took me a lot of experimentation to get the right ffmpeg settings to even get it to work, but I found another answer that provided a very complex set of parameters that ultimately worked.

    I have converted about 20 movies with this setting and every one results in a file size of 1.1GB. I have tried different file sizes and crf settings and it is the same every time.

    Here is an example. First, the original file :

    General
    Complete name                            : Charlotte's Web.m4v
    Format                                   : MPEG-4
    Format profile                           : Base Media / Version 2
    Codec ID                                 : mp42 (isom/iso2/avc1/mp41)
    File size                                : 4.17 GiB
    Duration                                 : 1 h 36 min
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 6 161 kb/s
    Movie name                               : Charlotte's Web
    Performer                                : Julia Roberts, Steve Buscemi, John Cleese, Oprah Winfrey, Cedric the Entertainer, Reba McEntire, Kathy Bates, Robert Redford, Thomas Haden Church, André Benjamin, Dominic Scott Kay, Sam Shepard, Abraham Benrubi, Dakota Fanning, Kevin Anderson, Essie Davis, Siobhan Fallon, Louis Corbett, Robyn Arthur, Julian O'Donnell, Gary Basaraba, Nate Mooney, Nicholas Bell, Beau Bridges, Teague Rook, Julia Zemiro, Denise Kirby, Robert Plazek, Joseph Lotesto, Michael Roland, Don Bridges, Ian Watkin, Joel McCrary, Brian Stepanek, Fred Tatasciore, Bradley White, Maia Kirkpatrick, Jennessa Rose, Briana Hodge, Dale Azzopardi, Geoff Burgess, Ella Scott Lynch, Greg Marian, Stefano Mazzeo, Elizabeth Saunders
    Director                                 : Gary Winick
    Actor                                    : Julia Roberts / Steve Buscemi / John Cleese / Oprah Winfrey / Cedric the Entertainer / Reba McEntire / Kathy Bates / Robert Redford / Thomas Haden Church / André Benjamin / Dominic Scott Kay / Sam Shepard / Abraham Benrubi / Dakota Fanning / Kevin Anderson / Essie Davis / Siobhan Fallon / Louis Corbett / Robyn Arthur / Julian O'Donnell / Gary Basaraba / Nate Mooney / Nicholas Bell / Beau Bridges / Teague Rook / Julia Zemiro / Denise Kirby / Robert Plazek / Joseph Lotesto / Michael Roland / Don Bridges / Ian Watkin / Joel McCrary / Brian Stepanek / Fred Tatasciore / Bradley White / Maia Kirkpatrick / Jennessa Rose / Briana Hodge / Dale Azzopardi / Geoff Burgess / Ella Scott Lynch / Greg Marian / Stefano Mazzeo / Elizabeth Saunders
    Screenplay by                            : Karey Kirkpatrick / Susannah Grant / Earl Hamner / Jr. / E.B. White
    Producer                                 : Julia Pistor / Jordan Kerner / Paul Neesan / Edgar M. Bronfman / Bernard Williams / Tony Winley
    Genre                                    : Comedy
    ContentType                              : Short Film
    Description                              : Wilbur the pig is scared of the end of the season, because he knows that come that time, he will end up on the dinner table. He hatches a plan with Charlotte, a spider that lives in his pen, to ensure that this will never happen.
    Recorded date                            : UTC 2006-12-15 11:00:00
    Encoded date                             : UTC 2017-01-23 02:37:54
    Tagged date                              : UTC 2017-01-24 01:19:52
    Writing application                      : HandBrake 1.0.1 2016122900
    Cover                                    : Yes
    LongDescription                          : Wilbur the pig is scared of the end of the season, because he knows that come that time, he will end up on the dinner table. He hatches a plan with Charlotte, a spider that lives in his pen, to ensure that this will never happen.
    ContentRating                            : mpaa|G|100|

    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L4
    Format settings                          : CABAC / 4 Ref Frames
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 1 h 36 min
    Bit rate                                 : 5 691 kb/s
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Variable
    Frame rate                               : 23.976 (24000/1001) FPS
    Minimum frame rate                       : 23.974 FPS
    Maximum frame rate                       : 23.981 FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.114
    Stream size                              : 3.86 GiB (92%)
    Writing library                          : x264 core 148 r2708 86b7198
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / 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=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=22.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=25000 / vbv_bufsize=31250 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
    Encoded date                             : UTC 2017-01-23 02:37:54
    Tagged date                              : UTC 2017-01-23 02:37:54
    Color range                              : Limited
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    Menus                                    : 4

    Here is the first encode settings :

    ffmpeg -i "$1" -sn -c:a libmp3lame -ar 48000 -ab 128k -ac 2 -c:v mpeg4 -crf 24 -vtag DIVX -vf scale=1024x600:force_original_aspect_ratio=decrease -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 30 -vb 1500k "$2"

    And the resulting mediainfo :

    General
    Complete name                            : Charlotte's Web (2006) - DIVX.avi
    Format                                   : AVI
    Format/Info                              : Audio Video Interleave
    Format profile                           : OpenDML
    File size                                : 1.11 GiB
    Duration                                 : 1 h 36 min
    Overall bit rate                         : 1 644 kb/s
    Movie name                               : Charlotte's Web
    Director                                 : Julia Roberts, Steve Buscemi, John Cleese, Oprah Winfrey, Cedric the Entertainer, Reba McEntire, Kathy Bates, Robert Redford, Thomas Haden Church, André Benjamin, Dominic Scott Kay, Sam Shepard, Abraham Benrubi, Dakota Fanning, Kevin Anderson, Essie Davis, Siobhan Fallon, Louis Corbett, Robyn Arthur, Julian O'Donnell, Gary Basaraba, Nate Mooney, Nicholas Bell, Beau Bridges, Teague Rook, Julia Zemiro, Denise Kirby, Robert Plazek, Joseph Lotesto, Michael Roland, Don Bridges, Ian Watkin, Joel McCrary, Brian Stepanek, Fred Tatasciore, Bradley White, Maia Kirkpatrick, Jennessa Rose, Briana Hodge, Dale Azzopardi, Geoff Burgess, Ella Scott Lynch, Greg Marian, Stefano Mazzeo, Elizabeth Saunders
    Genre                                    : Comedy
    Recorded date                            : UTC 2006-12-15 11:00:00
    Writing application                      : Lavf57.56.100

    Video
    ID                                       : 0
    Format                                   : MPEG-4 Visual
    Format profile                           : Simple@L1
    Format settings, BVOP                    : No
    Format settings, QPel                    : No
    Format settings, GMC                     : No warppoints
    Format settings, Matrix                  : Default (H.263)
    Codec ID                                 : DIVX
    Codec ID/Info                            : Project Mayo
    Codec ID/Hint                            : DivX 4
    Duration                                 : 1 h 36 min
    Bit rate                                 : 1 500 kb/s
    Width                                    : 1 024 pixels
    Height                                   : 576 pixels
    Display aspect ratio                     : 16:9
    Frame rate                               : 23.976 (24000/1001) FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.106
    Stream size                              : 1.02 GiB (91%)
    Writing library                          : Lavc57.64.100

    Here was my attempt at a smaller file size (lower crf and smaller scale setting) :

    ffmpeg -i "Charlotte's Web.m4v" -sn -c:a libmp3lame -ar 48000 -ab 128k -ac 2 -c:v mpeg4 -crf 30 -vtag DIVX -vf scale=800:480 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 30 -vb 1500k "Charlotte's Web (2006) - DIVX 2.avi"

    And the resulting mediainfo :

    General
    Complete name                            : Charlotte's Web (2006) - DIVX 2.avi
    Format                                   : AVI
    Format/Info                              : Audio Video Interleave
    Format profile                           : OpenDML
    File size                                : 1.11 GiB
    Duration                                 : 1 h 36 min
    Overall bit rate                         : 1 643 kb/s
    Movie name                               : Charlotte's Web
    Director                                 : Julia Roberts, Steve Buscemi, John Cleese, Oprah Winfrey, Cedric the Entertainer, Reba McEntire, Kathy Bates, Robert Redford, Thomas Haden Church, André Benjamin, Dominic Scott Kay, Sam Shepard, Abraham Benrubi, Dakota Fanning, Kevin Anderson, Essie Davis, Siobhan Fallon, Louis Corbett, Robyn Arthur, Julian O'Donnell, Gary Basaraba, Nate Mooney, Nicholas Bell, Beau Bridges, Teague Rook, Julia Zemiro, Denise Kirby, Robert Plazek, Joseph Lotesto, Michael Roland, Don Bridges, Ian Watkin, Joel McCrary, Brian Stepanek, Fred Tatasciore, Bradley White, Maia Kirkpatrick, Jennessa Rose, Briana Hodge, Dale Azzopardi, Geoff Burgess, Ella Scott Lynch, Greg Marian, Stefano Mazzeo, Elizabeth Saunders
    Genre                                    : Comedy
    Recorded date                            : UTC 2006-12-15 11:00:00
    Writing application                      : Lavf57.56.100

    Video
    ID                                       : 0
    Format                                   : MPEG-4 Visual
    Format profile                           : Simple@L1
    Format settings, BVOP                    : No
    Format settings, QPel                    : No
    Format settings, GMC                     : No warppoints
    Format settings, Matrix                  : Default (H.263)
    Codec ID                                 : DIVX
    Codec ID/Info                            : Project Mayo
    Codec ID/Hint                            : DivX 4
    Duration                                 : 1 h 36 min
    Bit rate                                 : 1 499 kb/s
    Width                                    : 800 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 16:9
    Frame rate                               : 23.976 (24000/1001) FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.163
    Stream size                              : 1.02 GiB (91%)
    Writing library                          : Lavc57.64.100

    Same file size but lower resolution.

    Any ideas on what the best settings to achieve my goal ?

  • Developing MobyCAIRO

    26 mai 2021, par Multimedia Mike — General

    I recently published a tool called MobyCAIRO. The ‘CAIRO’ part stands for Computer-Assisted Image ROtation, while the ‘Moby’ prefix refers to its role in helping process artifact image scans to submit to the MobyGames database. The tool is meant to provide an accelerated workflow for rotating and cropping image scans. It works on both Windows and Linux. Hopefully, it can solve similar workflow problems for other people.

    As of this writing, MobyCAIRO has not been tested on Mac OS X yet– I expect some issues there that should be easily solvable if someone cares to test it.

    The rest of this post describes my motivations and how I arrived at the solution.

    Background
    I have scanned well in excess of 2100 images for MobyGames and other purposes in the past 16 years or so. The workflow looks like this :


    Workflow diagram

    Image workflow


    It should be noted that my original workflow featured me manually rotating the artifact on the scanner bed in order to ensure straightness, because I guess I thought that rotate functions in image editing programs constituted dark, unholy magic or something. So my workflow used to be even more arduous :


    Longer workflow diagram

    I can’t believe I had the patience to do this for hundreds of scans


    Sometime last year, I was sitting down to perform some more scanning and found myself dreading the oncoming tedium of straightening and cropping the images. This prompted a pivotal question :


    Why can’t a computer do this for me ?

    After all, I have always been a huge proponent of making computers handle the most tedious, repetitive, mind-numbing, and error-prone tasks. So I did some web searching to find if there were any solutions that dealt with this. I also consulted with some like-minded folks who have to cope with the same tedious workflow.

    I came up empty-handed. So I endeavored to develop my own solution.

    Problem Statement and Prior Work

    I want to develop a workflow that can automatically rotate an image so that it is straight, and also find the most likely crop rectangle, uniformly whitening the area outside of the crop area (in the case of circles).

    As mentioned, I checked to see if any other programs can handle this, starting with my usual workhorse, Photoshop Elements. But I can’t expect the trimmed down version to do everything. I tried to find out if its big brother could handle the task, but couldn’t find a definitive answer on that. Nor could I find any other tools that seem to take an interest in optimizing this particular workflow.

    When I brought this up to some peers, I received some suggestions, including an idea that the venerable GIMP had a feature like this, but I could not find any evidence. Further, I would get responses of “Program XYZ can do image rotation and cropping.” I had to tamp down on the snark to avoid saying “Wow ! An image editor that can perform rotation AND cropping ? What a game-changer !” Rotation and cropping features are table stakes for any halfway competent image editor for the last 25 or so years at least. I am hoping to find or create a program which can lend a bit of programmatic assistance to the task.

    Why can’t other programs handle this ? The answer seems fairly obvious : Image editing tools are general tools and I want a highly customized workflow. It’s not reasonable to expect a turnkey solution to do this.

    Brainstorming An Approach
    I started with the happiest of happy cases— A disc that needed archiving (a marketing/press assets CD-ROM from a video game company, contents described here) which appeared to have some pretty clear straight lines :


    Ubisoft 2004 Product Catalog CD-ROM

    My idea was to try to find straight lines in the image and then rotate the image so that the image is parallel to the horizontal based on the longest single straight line detected.

    I just needed to figure out how to find a straight line inside of an image. Fortunately, I quickly learned that this is very much a solved problem thanks to something called the Hough transform. As a bonus, I read that this is also the tool I would want to use for finding circles, when I got to that part. The nice thing about knowing the formal algorithm to use is being able to find efficient, optimized libraries which already implement it.

    Early Prototype
    A little searching for how to perform a Hough transform in Python led me first to scikit. I was able to rapidly produce a prototype that did some basic image processing. However, running the Hough transform directly on the image and rotating according to the longest line segment discovered turned out not to yield expected results.


    Sub-optimal rotation

    It also took a very long time to chew on the 3300×3300 raw image– certainly longer than I care to wait for an accelerated workflow concept. The key, however, is that you are apparently not supposed to run the Hough transform on a raw image– you need to compute the edges first, and then attempt to determine which edges are ‘straight’. The recommended algorithm for this step is the Canny edge detector. After applying this, I get the expected rotation :


    Perfect rotation

    The algorithm also completes in a few seconds. So this is a good early result and I was feeling pretty confident. But, again– happiest of happy cases. I should also mention at this point that I had originally envisioned a tool that I would simply run against a scanned image and it would automatically/magically make the image straight, followed by a perfect crop.

    Along came my MobyGames comrade Foxhack to disabuse me of the hope of ever developing a fully automated tool. Just try and find a usefully long straight line in this :


    Nascar 07 Xbox Scan, incorrectly rotated

    Darn it, Foxhack…

    There are straight edges, to be sure. But my initial brainstorm of rotating according to the longest straight edge looks infeasible. Further, it’s at this point that we start brainstorming that perhaps we could match on ratings badges such as the standard ESRB badges omnipresent on U.S. video games. This gets into feature detection and complicates things.

    This Needs To Be Interactive
    At this point in the effort, I came to terms with the fact that the solution will need to have some element of interactivity. I will also need to get out of my safe Linux haven and figure out how to develop this on a Windows desktop, something I am not experienced with.

    I initially dreamed up an impressive beast of a program written in C++ that leverages Windows desktop GUI frameworks, OpenGL for display and real-time rotation, GPU acceleration for image analysis and processing tricks, and some novel input concepts. I thought GPU acceleration would be crucial since I have a fairly good GPU on my main Windows desktop and I hear that these things are pretty good at image processing.

    I created a list of prototyping tasks on a Trello board and made a decent amount of headway on prototyping all the various pieces that I would need to tie together in order to make this a reality. But it was ultimately slowgoing when you can only grab an hour or 2 here and there to try to get anything done.

    Settling On A Solution
    Recently, I was determined to get a set of old shareware discs archived. I ripped the data a year ago but I was blocked on the scanning task because I knew that would also involve tedious straightening and cropping. So I finally got all the scans done, which was reasonably quick. But I was determined to not manually post-process them.

    This was fairly recent, but I can’t quite recall how I managed to come across the OpenCV library and its Python bindings. OpenCV is an amazing library that provides a significant toolbox for performing image processing tasks. Not only that, it provides “just enough” UI primitives to be able to quickly create a basic GUI for your program, including image display via multiple windows, buttons, and keyboard/mouse input. Furthermore, OpenCV seems to be plenty fast enough to do everything I need in real time, just with (accelerated where appropriate) CPU processing.

    So I went to work porting the ideas from the simple standalone Python/scikit tool. I thought of a refinement to the straight line detector– instead of just finding the longest straight edge, it creates a histogram of 360 rotation angles, and builds a list of lines corresponding to each angle. Then it sorts the angles by cumulative line length and allows the user to iterate through this list, which will hopefully provide the most likely straightened angle up front. Further, the tool allows making fine adjustments by 1/10 of an angle via the keyboard, not the mouse. It does all this while highlighting in red the straight line segments that are parallel to the horizontal axis, per the current candidate angle.


    MobyCAIRO - rotation interface

    The tool draws a light-colored grid over the frame to aid the user in visually verifying the straightness of the image. Further, the program has a mode that allows the user to see the algorithm’s detected edges :


    MobyCAIRO - show detected lines

    For the cropping phase, the program uses the Hough circle transform in a similar manner, finding the most likely circles (if the image to be processed is supposed to be a circle) and allowing the user to cycle among them while making precise adjustments via the keyboard, again, rather than the mouse.


    MobyCAIRO - assisted circle crop

    Running the Hough circle transform is a significantly more intensive operation than the line transform. When I ran it on a full 3300×3300 image, it ran for a long time. I didn’t let it run longer than a minute before forcibly ending the program. Is this approach unworkable ? Not quite– It turns out that the transform is just as effective when shrinking the image to 400×400, and completes in under 2 seconds on my Core i5 CPU.

    For rectangular cropping, I just settled on using OpenCV’s built-in region-of-interest (ROI) facility. I tried to intelligently find the best candidate rectangle and allow fine adjustments via the keyboard, but I wasn’t having much success, so I took a path of lesser resistance.

    Packaging and Residual Weirdness
    I realized that this tool would be more useful to a broader Windows-using base of digital preservationists if they didn’t have to install Python, establish a virtual environment, and install the prerequisite dependencies. Thus, I made the effort to figure out how to wrap the entire thing up into a monolithic Windows EXE binary. It is available from the project’s Github release page (another thing I figured out for the sake of this project !).

    The binary is pretty heavy, weighing in at a bit over 50 megabytes. You might advise using compression– it IS compressed ! Before I figured out the --onefile command for pyinstaller.exe, the generated dist/ subdirectory was 150 MB. Among other things, there’s a 30 MB FORTRAN BLAS library packaged in !

    Conclusion and Future Directions
    Once I got it all working with a simple tkinter UI up front in order to select between circle and rectangle crop modes, I unleashed the tool on 60 or so scans in bulk, using the Windows forfiles command (another learning experience). I didn’t put a clock on the effort, but it felt faster. Of course, I was livid with proudness the whole time because I was using my own tool. I just wish I had thought of it sooner. But, really, with 2100+ scans under my belt, I’m just getting started– I literally have thousands more artifacts to scan for preservation.

    The tool isn’t perfect, of course. Just tonight, I threw another scan at MobyCAIRO. Just go ahead and try to find straight lines in this specimen :


    Reading Who? Reading You! CD-ROM

    I eventually had to use the text left and right of center to line up against the grid with the manual keyboard adjustments. Still, I’m impressed by how these computer vision algorithms can see patterns I can’t, highlighting lines I never would have guessed at.

    I’m eager to play with OpenCV some more, particularly the video processing functions, perhaps even some GPU-accelerated versions.

    The post Developing MobyCAIRO first appeared on Breaking Eggs And Making Omelettes.

  • ffmpeg concatenation after using drawtext filter

    12 août 2016, par Sven Hoskens

    I’m fairly new to ffmpeg, but after a few days of searching on this issue, I’ve completely hit a brick wall. Any help would be appreciated.

    My use case : Our client wants to upload videos for multiple regions. Each video will be the same format, 1920x1080, mp4. For each region, they want to add a different image at the end of the video, for a few seconds. This image contains their logo, some additional info, and a variable code. They will enter this code alongside the uploaded video. The image stays the same, so is already present on the server.
    So basically, I have an input video, a video of an image, and a small code. I need to add this code to the video of the image (in a predefined position), and then I need to add the resulting video to the end of the input video. Once that is complete, I just need to output the video in 1920x1080 and in 1024x576.

    I have tried several things, but the concatenation step always fails with the manipulated video’s.

    Attempt 1

    In my first attempt, I used ffmpeg to create a video from an image, and add the text in the designated area.

    ffmpeg -y -f lavfi -i image.png -r 30 -t 10 -pix_fmt yuv420p -map 0:v -vf drawtext="fontfile=HelveticaNeue.dfont: text='GLNS/TEST/1234b': fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=7: x=179: y=805" imageVideo.mp4

    This command creates a .mp4 video of the correct size, with a duration of 10 seconds, and adds the text ’GLNS/TEST/1234b’ in the correct location.

    Next, I use the following command to concatenate the two videos. Both have the same resolution and codec.

    ffmpeg -f concat -safe 0 -i config.txt -vf scale=1920:1080 outputHD.mp4 -vf scale=1024:576 outputSD.mp4

    config.txt contains following :

    file my_input_file.mp4
    file ImageVideo.mp4

    This concatenation works with regular videos. However, when I use it with ImageVideo.mp4 (the one created by the first command) I get this error log :

    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f86dc924600] Auto-inserting h264_mp4toannexb bitstream filtereed=0.509x    
    [aac @ 0x7f86dc019e00] Number of bands (31) exceeds limit (5).
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 0x7f86dc019e00] Number of bands (27) exceeds limit (8).
    Error while decoding stream #0:1: Invalid data found when processing input
    [h264 @ 0x7f86dd857200] Error splitting the input into NAL units.
    [h264 @ 0x7f86dd829400] Invalid NAL unit size.
    [h264 @ 0x7f86dd829400] Error splitting the input into NAL units.
    [aac @ 0x7f86dc019e00] Number of bands (10) exceeds limit (1).
    Error while decoding stream #0:1: Invalid data found when processing input
    [h264 @ 0x7f86dd816800] Invalid NAL unit size.
    [h264 @ 0x7f86dd816800] Error splitting the input into NAL units.
    [aac @ 0x7f86dc019e00] Number of bands (24) exceeds limit (1).
    Error while decoding stream #0:1: Invalid data found when processing input

    #this goes on for a few hundred lines

    The resulting output is identical to the input video, but does not contain the desired image video at the end.

    Attempt 2

    Since the above attempt didn’t work, I tried concatenating a video I let our designer make of the image with Adobe After Effects. This video was also saved as a .mp4 with the H264 codec. If I concatenate the input video and this one, I get a correct result. However, as soon as I add the code in the designated area with this command :

    ffmpeg -i new_image_video.mp4 -vf drawtext="fontfile=HelveticaNeue.dfont: text='GLNS/TEST/1234b': fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=7: x=179: y=805" -c:v libx264 imageVideo.mp4

    I get this error :

    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ff94c800000] Auto-inserting h264_mp4toannexb bitstream filter97x    
    [h264 @ 0x7ff94b053800] top block unavailable for requested intra mode -1
    [h264 @ 0x7ff94b053800] error while decoding MB 0 0, bytestream 49526
    [h264 @ 0x7ff94b053e00] number of reference frames (1+3) exceeds max (3; probably corrupt input), discarding one
    [h264 @ 0x7ff94b053e00] chroma_log2_weight_denom 28 is out of range
    [h264 @ 0x7ff94b053e00] illegal long ref in memory management control operation 2
    [h264 @ 0x7ff94b053e00] cabac_init_idc 32 overflow
    [h264 @ 0x7ff94b053e00] decode_slice_header error
    [h264 @ 0x7ff94b053e00] no frame!
    [h264 @ 0x7ff94b053800] concealing 8160 DC, 8160 AC, 8160 MV errors in I frame
    [h264 @ 0x7ff94b072a00] reference overflow 22 > 15 or 0 > 15
    [h264 @ 0x7ff94b072a00] decode_slice_header error
    [h264 @ 0x7ff94b072a00] no frame!
    [h264 @ 0x7ff94b01a400] illegal modification_of_pic_nums_idc 20
    [h264 @ 0x7ff94b01a400] decode_slice_header error
    [h264 @ 0x7ff94b01a400] no frame!
    [h264 @ 0x7ff94b01aa00] illegal modification_of_pic_nums_idc 20
    [h264 @ 0x7ff94b01aa00] decode_slice_header error
    [h264 @ 0x7ff94b01aa00] no frame!
    Error while decoding stream #0:0: Invalid data found when processing input
    [h264 @ 0x7ff94b053800] deblocking_filter_idc 8 out of range
    [h264 @ 0x7ff94b053800] decode_slice_header error
    [h264 @ 0x7ff94b053800] no frame!
    Error while decoding stream #0:0: Invalid data found when processing input
    [h264 @ 0x7ff94b053e00] illegal memory management control operation 8
    [h264 @ 0x7ff94b053e00] co located POCs unavailable
    [h264 @ 0x7ff94b053e00] error while decoding MB 2 0, bytestream -35
    [h264 @ 0x7ff94b053e00] concealing 8160 DC, 8160 AC, 8160 MV errors in B frame
    [h264 @ 0x7ff94b072a00] number of reference frames (1+3) exceeds max (3; probably corrupt input), discarding one

    # this goes on for a while...

    [h264 @ 0x7ff94b01a400] concealing 4962 DC, 4962 AC, 4962 MV errors in B frame
    Error while decoding stream #0:0: Invalid data found when processing input
    frame= 2553 fps= 17 q=-1.0 Lsize=   26995kB time=00:01:42.16 bitrate=2164.6kbits/s dup=0 drop=60 speed=0.697x    
    video:25258kB audio:1661kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.285236%
    [libx264 @ 0x7ff94b810400] frame I:35    Avg QP:17.45  size: 55070
    [libx264 @ 0x7ff94b810400] frame P:711   Avg QP:19.73  size: 18712
    [libx264 @ 0x7ff94b810400] frame B:1807  Avg QP:21.53  size:  5884
    [libx264 @ 0x7ff94b810400] consecutive B-frames:  3.4%  5.0%  4.9% 86.6%
    [libx264 @ 0x7ff94b810400] mb I  I16..4: 38.2% 49.3% 12.5%
    [libx264 @ 0x7ff94b810400] mb P  I16..4: 12.4% 14.0%  1.0%  P16..4: 29.6%  4.8%  1.9%  0.0%  0.0%    skip:36.2%
    [libx264 @ 0x7ff94b810400] mb B  I16..4:  1.5%  1.2%  0.1%  B16..8: 27.3%  1.6%  0.1%  direct: 1.8%  skip:66.4%  L0:45.8% L1:51.4% BI: 2.8%
    [libx264 @ 0x7ff94b810400] 8x8 transform intra:49.5% inter:85.4%
    [libx264 @ 0x7ff94b810400] coded y,uvDC,uvAC intra: 21.2% 22.3% 2.5% inter: 4.6% 7.0% 0.0%
    [libx264 @ 0x7ff94b810400] i16 v,h,dc,p: 23% 26% 10% 41%
    [libx264 @ 0x7ff94b810400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 19% 35%  3%  3%  3%  3%  3%  2%
    [libx264 @ 0x7ff94b810400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 20% 16%  5%  7%  6%  5%  5%  4%
    [libx264 @ 0x7ff94b810400] i8c dc,h,v,p: 67% 16% 15%  2%
    [libx264 @ 0x7ff94b810400] Weighted P-Frames: Y:7.3% UV:4.2%
    [libx264 @ 0x7ff94b810400] ref P L0: 66.3%  8.7% 17.9%  7.0%  0.1%
    [libx264 @ 0x7ff94b810400] ref B L0: 88.2% 10.1%  1.7%
    [libx264 @ 0x7ff94b810400] ref B L1: 94.9%  5.1%
    [libx264 @ 0x7ff94b810400] kb/s:2026.12
    [aac @ 0x7ff94b072400] Qavg: 635.626

    The resulting output is identical to the input video, but does not contain the desired image video at the end.

    One thing I have noticed : When I inspect the video files on mac (Get info) they always contain these lines at ’More info’ :

    Dimensions: 1920 x 1080
    Codecs: H.264, AAC
    Color profile: HD(1-1-1)
    Duration: 01:42
    Audio channels: 2
    Last opened: Today 11:02

    However, the video’s which pass through the drawtext filter have this :

    Dimensions: 1920 x 1080
    Codecs: AAC, H.264
    Duration: 00:10
    Audio channels: 2
    Last opened: Today 11:07

    As you can see, there is no color profile entry, and the codecs have switched places. I assume this is related to my issue, but I can’t seem to find a fix for it.

    PS : The application will run in a php environment (Symfony). I noticed the concat command wasn’t available in the Symfony bundle for ffmpeg, so I’m using the regular terminal commands. I’ll execute these using php.

    EDIT
    Attempt 3

    On advise of a coworker, I tried converting the video to .avi and reconverting to .mp4, in the hopes this would lose any corrupted or extra info included by the drawtext filter. This spits out a completely different error.

    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f812413da00] Auto-inserting h264_mp4toannexb bitstream filtereed=0.516x    
    [concat @ 0x7f8124009a00] DTS 1569260 < 2551000 out of order
    [h264 @ 0x7f8124846800] left block unavailable for requested intra4x4 mode -1
    [h264 @ 0x7f8124846800] error while decoding MB 0 0, bytestream 47919
    [h264 @ 0x7f8124846800] concealing 8160 DC, 8160 AC, 8160 MV errors in I frame
    [aac @ 0x7f8125809a00] Queue input is backward in time
    [aac @ 0x7f8125815a00] Queue input is backward in time
    [h264 @ 0x7f8124846e00] number of reference frames (1+3) exceeds max (3; probably corrupt input), discarding one
    [h264 @ 0x7f8124846e00] chroma_log2_weight_denom 26 is out of range
    [h264 @ 0x7f8124846e00] deblocking_filter_idc 32 out of range
    [h264 @ 0x7f8124846e00] decode_slice_header error
    [h264 @ 0x7f8124846e00] no frame!
    [mp4 @ 0x7f8124802200] Non-monotonous DTS in output stream 0:1; previous: 4902912, current: 4505491; changing to 4902913. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x7f8125813000] Non-monotonous DTS in output stream 1:1; previous: 4902912, current: 4505491; changing to 4902913. This may result in incorrect timestamps in the output file.
    [h264 @ 0x7f8124803400] reference overflow 20 > 15 or 0 > 15
    [h264 @ 0x7f8124803400] decode_slice_header error
    [h264 @ 0x7f8124803400] no frame!
    [mp4 @ 0x7f8124802200] Non-monotonous DTS in output stream 0:1; previous: 4902913, current: 4506515; changing to 4902914. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x7f8125813000] Non-monotonous DTS in output stream 1:1; previous: 4902913, current: 4506515; changing to 4902914. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x7f8124802200] Non-monotonous DTS in output stream 0:1; previous: 4902914, current: 4507539; changing to 4902915. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x7f8125813000] Non-monotonous DTS in output stream 1:1; previous: 4902914, current: 4507539; changing to 4902915. This may result in incorrect timestamps in the output file.

    # Again, this continues for quite a while.