question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apostrophes are escaped a little too much

See original GitHub issue

Hello, I’m not 100% sure this is an issue with this library or if it’s something else, but basically I am attempting to use the ‘subtitles’ filter by feeding it an mkv file, ffmpeg always crashes and when I printed the stream arguments I got the below: ['-i', "tes't.mkv", '-filter_complex', "[0]subtitles=tes\\\\\\\\\\\\\\'t.mkv[s0]", '-map', '[s0]', "tes't.mkv2.mkv"]

This is for a file called tes't.mkv

This is a script I recreated this with:

import ffmpeg
import sys

file_path = "tes't.mkv"

def convert_video(file_path):
    #Create a stream
    stream = ffmpeg.input(file_path)
    #Apply subtitle filter
    stream = ffmpeg.filter_(stream,'subtitles',str(file_path))
    #Output file
    stream = ffmpeg.output(stream, file_path + '2.mkv')
    #Get to work
    print(ffmpeg.get_args(stream))

convert_video(file_path)

If I attempt to run this stream then ffmpeg crashes with the below error:

[Parsed_subtitles_0 @ 0x5591972f24a0] Unable to open tes\'t.mkv
[AVFilterGraph @ 0x5591972cd1c0] Error initializing filter 'subtitles' with args 'tes\\\'t.mkv'
Error initializing complex filters.
No such file or directory
Traceback (most recent call last):
  File "test.py", line 16, in <module>
    convert_video(file_path)
  File "test.py", line 14, in convert_video
    ffmpeg.run(stream)
  File "/home/baa/.local/lib/python3.6/site-packages/ffmpeg/_run.py", line 212, in run
    raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
lzkzlscommented, Mar 8, 2020

Hi, has this problem been solved? I have the same problem.

1reaction
JurgenDJcommented, May 10, 2019

Running against the same issue when trying to scale down. Simplified code example:

inputstream = ffmpeg.input(infile, ss='00:00:10.000', t='00:00:20.000')# start after 10s, sequence of 20s duration
# v0 = inputstream['v'].filter_('scale',"320:240") # this doesn't work, resulting in get_args item: '[0:v]scale=320\\\\\\\\\\\\:240[s0]'
v0 = inputstream['v'].filter_('scale',"320x240") # this works, resulting in get_args item '[0:v]scale=320x240[s0]'
a0 = inputstream['a']
outstream = ffmpeg.output(v0,a0, outfile, acodec='aac', audio_bitrate='96K',vcodec='libx265', crf='23' )

print(outstream.get_args())
outstream.run()

I’m actually trying to scale conditionally (only scale down for if source has bigger dimensions), for that I need to enter a more complex scaling value which involves expressions as found on https://trac.ffmpeg.org/wiki/Scaling

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should I escape the Apostrophe ( ' ) character with its HTML ...
You should ideally use as little escaping as possible and use UTF-8 to express characters natively. To do this you need an editor...
Read more >
When to Use an Apostrophe—And When You Shouldn't
Apostrophe usage doesn't have to be confusing. Here's the lowdown on when to use an apostrophe—and other apostrophe rules you need to know....
Read more >
Life's Short! So Why am I Fretting about Apostrophes and ...
I really am fretting—about the apostrophe in the phrase life's short. ... So, Bruce Cockburn shall forever escape scrutiny from the language law...
Read more >
How to escape apostrophe (') in MySql? - Stack Overflow
The MySQL documentation you cite actually says a little bit more than you mention. It also says,. A “ ' ” inside a...
Read more >
Apostrophes with Words and Names Ending in s
Rule 1: Many common nouns end in the letter s (lens, cactus, bus, etc.). So do ... There also are a few who...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found