Bug #10925

Error transcoding a filename with parentheses via ffmpeg

Added by Sarah Romkey about 5 years ago. Updated over 4 years ago.

Status:NewStart date:12/06/2016
Priority:MediumDue date:
Assignee:-% Done:

0%

Category:FPR
Target version:-
Google Code Legacy ID: Pull Request:
Sponsored:No Requires documentation:

Description

On Tue, Dec 6, 2016 at 12:45 PM, Tim Walsh <> wrote:

Hi folks,

I ran into an issue with ffmpeg in Archivematica today that I thought you might want to be aware of. It seems that an MP4 was unable to convert to ffv1 because ffmpeg choked on an unescaped parenthesis in the filepath (relevant part of filepath is 20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080.mp4)

When I ran the same file through our dev server in a path without parentheses, the file normalized for preservation successfully.

It seems to me that the issue is that in the normalization command, the path of the original file (the MP4) is enclosed in quotations, but the path of the output file (the ffv1) is not, and so the program chokes on the unescaped ( character in the output path.

Making a very minor change to the “Transcoding to mkv with ffmpeg” normalization rule in the third-to-last line fixed the problem:

Original: command="${command} ${outputFile}"
Fixed: command="${command} '${outputFile}'"

I would suggest wrapping this change into future releases!

The original normalization failure report is copied here, if you’re curious:

Task UUID: 9015d028-967e-4670-b249-8a5ae4d78c2f
File UUID: 2f9733aa-9d38-4fe6-b2f9-ab205877b937
File name: 20140825_CT_ANIMATION_HD1080.mp4
Client: CSP-ARCH-03_3
(exit code: 1)

Start time: 2016-12-06, 12:45:38 PM
End time: 2016-12-06, 12:45:39 PM
Created time: 2016-12-06, 12:45:34 PM
Duration: 1 second(s)

Command: normalize_v1.0 preservation "2f9733aa-9d38-4fe6-b2f9-ab205877b937" "/var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080.mp4" "/var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/" "141ed905-cb35-469e-bf69-0c921743bf80" "%taskUUID%" "original"

STDOUT
File found: 2f9733aa-9d38-4fe6-b2f9-ab205877b937 %SIPDirectory%objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080.mp4
File format: Video: MPEG-4 Media File: MPEG-4 Video
Format Policy Rule: Normalize Video: MPEG-4 Media File: MPEG-4 Video for Preservation via Transcoding to mkv with ffmpeg
Format Policy Command Transcoding to mkv with ffmpeg
Command to execute: #!/bin/bash

inputFile="/var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080.mp4"
outputFile="/var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080-9015d028-967e-4670-b249-8a5ae4d78c2f.mkv"
audioCodec="pcm_s16le"
videoCodec="ffv1 -level 3"

command="ffmpeg -vsync passthrough -i \"${inputFile}\" "
command="${command} -vcodec ${videoCodec} -g 1 "
command="${command} -acodec ${audioCodec}"

command="${command} ${outputFile}"

echo $command
eval $command

-----
Command stdout:
ffmpeg -vsync passthrough -i "/var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080.mp4" -vcodec ffv1 -level 3 -g 1 -acodec pcm_s16le /var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080-9015d028-967e-4670-b249-8a5ae4d78c2f.mkv

-----
Command exit code: 1

STDERR
/tmp/c2288b0d-2687-4855-a9d9-02935459fc73: eval: line 17: syntax error near unexpected token `('
/tmp/c2288b0d-2687-4855-a9d9-02935459fc73: eval: line 17: `ffmpeg -vsync passthrough -i "/var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080.mp4" -vcodec ffv1 -level 3 -g 1 -acodec pcm_s16le /var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080-9015d028-967e-4670-b249-8a5ae4d78c2f.mkv'

Failed: Transcoding to mkv with ffmpeg
Standard out: ffmpeg -vsync passthrough -i "/var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080.mp4" -vcodec ffv1 -level 3 -g 1 -acodec pcm_s16le /var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080-9015d028-967e-4670-b249-8a5ae4d78c2f.mkv

Standard error: /tmp/c2288b0d-2687-4855-a9d9-02935459fc73: eval: line 17: syntax error near unexpected token `('
/tmp/c2288b0d-2687-4855-a9d9-02935459fc73: eval: line 17: `ffmpeg -vsync passthrough -i "/var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080.mp4" -vcodec ffv1 -level 3 -g 1 -acodec pcm_s16le /var/archivematica/sharedDirectory/currentlyProcessing/AP174.S1.2001.D1.007-141ed905-cb35-469e-bf69-0c921743bf80/objects/data/objects/ANIMATIONS/20140825_CT_ANIMATION_FINAL/20140825_CT_ANIMATION_AE_(converted)_AME/20140825_CT_ANIMATION_HD1080-9015d028-967e-4670-b249-8a5ae4d78c2f.mkv'

Command Transcoding to mkv with ffmpeg failed!

--

Cheers,
Tim

History

#2 Updated by Justin Simpson almost 5 years ago

  • Assignee set to Justin Simpson
  • Target version changed from 1.6.1 to Release 1.7.0

Applying this fix to an FPR command through the UI is a simple and quick task, but creating a fix for future releases is more complicated. There is one FPCommand and 25 FPRules that need to be disabled and replaced with new ones, in a django migration in the archivematica-fpr-admin module.

We attempted to get this migration into fpr-admin in time for the Archivematica 1.6.1 bugfix release, but missed the code freeze deadline.

This fix will get completed for the 1.7.0 release.

#3 Updated by Justin Simpson over 4 years ago

  • Assignee deleted (Justin Simpson)
  • Target version deleted (Release 1.7.0)

Also available in: Atom PDF