LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-20-2019, 11:03 AM   #1
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
ffmpeg to join mp4 files


After upgrading from Mint 18 to Mint 19 (64bit) some of my ffmpeg scripts no longer work.
I've googled the error message and I cannot find a solution so here goes:

Files CROPPED-36.mp4 and CROPPED-37.mp4

The script:
Code:
ls CROPP*.mp4 | perl -ne 'print "file $_"' | ffmpeg -f concat -i - -c copy CROPP.mp4
The error message (after all the ffmpeg preamble):
Code:
[file @ 0x556f060a6000] Protocol 'file' not on whitelist 'crypto'!
[concat @ 0x556f060a3f40] Impossible to open 'CROPPED-PICT0036.mp4'
pipe:: Invalid argument
I have another method that works fine which is this:
Code:
[ -e list.txt ] && rm list.txt
for f in CROPP*.mp4
do
   echo "file $f" >> list.txt
done

ffmpeg -f concat -i list.txt -c copy  CROPP.mp4 && rm list.txt
I'm guessing the first method isn't generating the list of files to join, which points to the perl statement, bu I'm no expert with perl.

I'm sure someone can help so thanks in advance
 
Old 01-20-2019, 12:50 PM   #2
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
I think it may have been due to this ffmpeg update:

https://ffmpeg.org/pipermail/ffmpeg-...ch/098694.html

See https://blog.yo1.dog/fix-for-ffmpeg-...rror-for-urls/ for a solution, namely adding:

Code:
-safe "0" -protocol_whitelist "file"
near the start of the command.
 
Old 01-20-2019, 05:06 PM   #3
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by hydrurga View Post
I think it may have been due to this ffmpeg update:

https://ffmpeg.org/pipermail/ffmpeg-...ch/098694.html

See https://blog.yo1.dog/fix-for-ffmpeg-...rror-for-urls/ for a solution, namely adding:

Code:
-safe "0" -protocol_whitelist "file"
near the start of the command.
You're on the right track I think, but something else is missing, here's the command:
Code:
ls M*.mp4 | perl -ne 'print "file $_"' | ffmpeg -f concat -safe "0" -protocol_whitelist "file" -i - -c copy M-Joined.mp4
And the error message:
Code:
[pipe @ 0x56305401e9e0] Protocol 'pipe' not on whitelist 'file'!
pipe:: Invalid argument
Any ideas? Make sure you read the following post with a bit more detail.

Last edited by GPGAgent; 01-20-2019 at 05:52 PM.
 
Old 01-20-2019, 05:24 PM   #4
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
So just checking through my script I can't see why it's not working
I have these files:
Code:
ls MOV*.avi
MOVI0003.avi  MOVI0004.avi
And this code:
Code:
ls MOV*.avi | perl -ne 'print "file $_"'
Produces this:
Code:
file MOVI0003.avi
file MOVI0004.avi
Which gets piped to:
Code:
ffmpeg -f concat -safe "0" -protocol_whitelist "file" -i - -c copy M-Joined.avi
It should work, because it's effectively the same as what follows, but using a file - list.txt.

What does work is this:
Code:
ffmpeg -f concat -i list.txt -c copy  M-Joined.avi
Where list.txt contains this:
Code:
file MOVI0003.avi
file MOVI0004.avi
So any ideas folks.

Last edited by GPGAgent; 01-20-2019 at 05:51 PM.
 
Old 01-20-2019, 07:13 PM   #5
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
You need to add pipe to the whitelist.

Last edited by hydrurga; 01-20-2019 at 07:14 PM.
 
Old 01-21-2019, 04:40 AM   #6
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by hydrurga View Post
You need to add pipe to the whitelist.
Cheers, that worked just fine, obvious really, so it now looks like this:
Code:
ffmpeg -f concat -safe "0" -protocol_whitelist "file,pipe" -i - -c copy "${FileName/
works fine for mp4 file but not for .mov, here's the error:
Code:
[mov @ 0x55db06663900] fatal error, input packet contains no samples
av_interleaved_write_frame(): Not yet implemented in FFmpeg, patches welcome
[mov @ 0x55db06663900] fatal error, input packet contains no samples
Error writing trailer of 04-Joined.MOV: Not yet implemented in FFmpeg, patches welcome
frame=    2 fps=0.0 q=-1.0 Lsize=     109kB time=00:00:00.06 bitrate=13997.3kbits/s speed=31.4x    
video:108kB audio:2kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
Bit if I use my other method, echoing the file list into an actual file (see earlier post) like this:
Code:
ffmpeg -f concat -i list.txt -c copy  M-Joined.mov
where list.txt contains the list of files to join:
Code:
file MOVI0003.mov
file MOVI0004.mov
This works, it's using the same ffmpeg and switches?

Any ideas? Cheers
 
Old 01-21-2019, 01:02 PM   #7
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Further investigation is a bit mystifying, basically the -f concat option works if you have an actual file. So can someone explain why one statement works and the other doesn't?

The folder contains:
Code:
-rwxrwxrwx 1 charlie charlie 22503233 Nov 15  2017 CRP8.mp4
-rwxrwxrwx 1 charlie charlie 23221581 Nov 15  2017 CRP9.mp4
This statement works:
Code:
ls CRP*.mp4 | perl -ne 'print "file $_"' > LLL.txt | ffmpeg -y -f concat  -i LLL.txt -c copy JOINED-CRP.mp4
This statement does not work:
Code:
ls CRP*.mp4 | perl -ne 'print "file $_"' | ffmpeg -y -f concat -i - -c copy JOINED-CRP.mp4
The error message is this:
Code:
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[file @ 0x560e19057c80] Protocol 'file' not on whitelist 'crypto'!
[concat @ 0x560e19055f40] Impossible to open 'CRP8.mp4'
pipe:: Invalid argument
Okay I know I can put the protocol and whitelist switches into the statement, but the statement that works, using a file to hold the list of files to join doesn't need these switches, that's the puzzle.

Looking forward to an explanation, over to you guys and gals.
 
Old 01-21-2019, 02:23 PM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by GPGAgent View Post
basically the -f concat option works if you have an actual file.
that is my experience also.
maybe you can use a here string instead of an actual file?
 
Old 01-21-2019, 04:43 PM   #9
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by ondoho View Post
that is my experience also.
maybe you can use a here string instead of an actual file?
My point is that the -f concat with a - did work just fine with Mint 18. Now I've upgraded to Mint 19 so has ffmpeg and my old script no longer works

Both of these scripts worked on Mint 18
Code:
ls CRP*.mp4 | perl -ne 'print "file $_"' | ffmpeg -y -f concat -i - -c copy JOINED-CRP.mp4
ls CRP*.mp4 | perl -ne 'print "file $_"' > LLL.txt | ffmpeg -y -f concat -i LLL.txt -c copy JOINED-CRP.mp4
but now only this one works:
Code:
ls CRP*.mp4 | perl -ne 'print "file $_"' > LLL.txt | ffmpeg -y -f concat -i LLL.txt -c copy JOINED-CRP.mp4
Read through the entire thread and you'll see how I got here.

Thanks for your time anyway.
 
Old 01-22-2019, 12:52 AM   #10
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by GPGAgent View Post
My point is that the -f concat with a - did work just fine with Mint 18. Now I've upgraded to Mint 19 so has ffmpeg and my old script no longer works
so your point is not to find a solution for your problem, but to complain about ffmpeg's behavior having changed?
 
Old 01-22-2019, 04:45 AM   #11
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Rep: Reputation: 290Reputation: 290Reputation: 290
@GPGAgent: I don't have your answer but the last pipe in the following command seems useless to me:
Code:
ls CRP*.mp4 | perl -ne 'print "file $_"' > LLL.txt | ffmpeg -y -f concat -i LLL.txt -c copy JOINED-CRP.mp4
You should try:
Code:
ls CRP*.mp4 | perl -ne 'print "file $_"' > LLL.txt && ffmpeg -y -f concat -i LLL.txt -c copy JOINED-CRP.mp4
 
Old 01-22-2019, 05:08 AM   #12
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Thumbs up

Quote:
Originally Posted by ondoho View Post
so your point is not to find a solution for your problem, but to complain about ffmpeg's behavior having changed?
I'm not complaining, I don't know how you come to that conclusion. Thanks anyway, everyday with linux is a school day, you never stop learning which is why this is great forum.

Some really knowledgeable people here and really helpful.
 
Old 01-22-2019, 05:11 AM   #13
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by l0f4r0 View Post
@GPGAgent: I don't have your answer but the last pipe in the following command seems useless to me:
Code:
ls CRP*.mp4 | perl -ne 'print "file $_"' > LLL.txt | ffmpeg -y -f concat -i LLL.txt -c copy JOINED-CRP.mp4
You should try:
Code:
ls CRP*.mp4 | perl -ne 'print "file $_"' > LLL.txt && ffmpeg -y -f concat -i LLL.txt -c copy JOINED-CRP.mp4
Okay, interesting point, both work as expected

Thanks

Last edited by GPGAgent; 01-22-2019 at 09:22 AM.
 
Old 01-22-2019, 12:52 PM   #14
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by hydrurga View Post
I think it may have been due to this ffmpeg update:

https://ffmpeg.org/pipermail/ffmpeg-...ch/098694.html

See https://blog.yo1.dog/fix-for-ffmpeg-...rror-for-urls/ for a solution, namely adding:

Code:
-safe "0" -protocol_whitelist "file"
near the start of the command.
Well I think this is solved, I re-read those links, and missed how important the positioning of the -protocol_whitelist switch was.

So this now works fine:
Code:
ls 19*.mp4 | perl -ne 'print "file $_"' | ffmpeg -protocol_whitelist "file,pipe" -f concat -i - -c copy JOINED-FIL.mp4
I've dropped the -safe switch for now, but may need it problems occur.

Cheers and thanks for your help and pointer to the solution
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
10d6:1101 Actions Semiconductor Co., Ltd D-Wave 2GB MP4 Player / AK1025 MP3/MP4 Player T RandomTroll General 5 07-19-2018 10:42 PM
[SOLVED] Having a problem converting MOV files to MP4 using FFMPEG rstuff Linux - Newbie 14 12-02-2016 12:23 AM
LXer: How to use ffmpeg to compress avi and mp4 files LXer Syndicated Linux News 0 07-23-2012 05:50 AM
[SOLVED] how do i merge mp4 video files using ffmpeg ? dEnDrOn Linux - Software 2 02-04-2012 06:17 AM
converter for mp4, I-Pods and other portable mp4's ? stefan_rogin2000 Linux - Software 5 03-26-2008 02:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration