three ways to achieve an H264 file [closed] - c

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
here I have three ways to get an H264 file, like all forensic scientists, I am very curious about the differences between them:
1.
ffmpeg -i video.mp4 video.h264
2.
ffmpeg -i video.mp4 -vcodec copy -an -f h264 video.h264
3. Using the example "demuxing_decoding.c" provided on the ffmpeg official website:
http://ffmpeg.org/doxygen/trunk/demuxing_decoding_8c-example.html
Obviously, the first one does the transformation, and the second one does the demuxing. They render different H264 files which however have similar file sizes(in my case, it's about say 24 MB). Suprisingly, the third one, which is also supposed to do the demuxing job, renders an H264 file with 8.4 GB! Why?
What I wondered is really, how the interiors of these three methods work?(The third one is already in source code, therefore it's quite easy to have an insight) What about the first two commands? What APIs are called when executing these two commands and how those APIs are called(namely, in what kind of sequences they are called) and things like that.
One thing that is also important to me is, i have no idea how I can trace the execution routines of ffmpeg command lines. I want to see what's going on behind ffmpeg commands in source code version. Is it possible?
I appreciate any comment.

Related

Bash: different behaviour reading from file interactive/cron [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have a script that writes about 20 numbers line by line to a file during processing.
When the script starts again, it reads from this file with this code
declare -a sedum
i=0
while read -r line
do
sedum[$i]=$line
i=$(( $i + 1 ))
done < $f_sday
f_sday contains the filename. When I call the script from comand line it always works fine and reads the complete content of the file.
But when the script is called in a cronjob it reads only two or three values
I know that from cron it might not be the same environment but I can't see any environmental dependency here.
I tried mapfile at first, but that read only two of the twenty values.
Any idea what I am missing here?
Stupid me.
I did not control the working path (cron starts in $HOME), so the script was working on the wrong file.
Thanks for the set -x hint. That led me on the right path!

bash array from string keeping only content between delimiters [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm trying to create a bash script that uses info pulled from Wikipedia via curl to help sort my music collection. I've gotten it to reliably return the information I want, but because of Wikipedia's formatting, there is sometimes information I want to discard. It is also not always formatted consistently; sometimes it is on multiple lines, and sometimes only one, but the information I want is consistently delimited between "[[" and "]]". I want to keep only the text between [[ and ]] and ignore the rest. All of the solutions I've found so far use sed and rely on consistent formatting. Basically what I want to do is take a long string formatted:
{{[[abcd]]efgh[[hijk]]lmno
[[pqrs]]
[[tuvw]]yz}}
and create an array with the values
abcd
hijk
pqrs
tuvw
With GNU grep and a Perl-compatible regular expression (PCRE):
grep -Po '(?<=\[\[).*?(?=]])' file
Output:
abcd
hijk
pqrs
tuvw

Unix cat command with output redirection metacharacter >, create empty files [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am using following code to create a new file cat15 using cat command in UNIX
# cat > cat15
this command adds a new file cat15 in root directory and whatever I type after this command is being stored into the file created. But I am not able to exit from this editor.
In other word, I am not getting Shell prompt symbol #
The cat command reads from STDIN if you don't specify a filename. It continues to do this until it receives an EOF or is killed. You can send an EOF and get your terminal back by typing <ctrl>+d.
What people generally do is to either use
touch filename
or
echo -n > filename
to create an empty file. As Charles correctly notes below, "echo -n" is not always a good idea (though you can usually count on it under "popular" Linux distros); I'd strongly suggest just using touch.
If you just want to create an empty file, regardless of whether one existed or not, you can just use ">" like this:
> cat15
It will clobber anything that already exists by that name.

Using the man command in Unix, I want to list file names with file size etc. [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
By using the man command I want to list the names of the files I have already created with extra information such as filesize, date of modification etc.
I know I have to use the man command possibly something like:
man ls | documents
But this would not seem to work. If anyone would know how to do this that would be great? Any help would be much appreciated.
You use man to read the contents of the manual, not list files.
Use ls to list your files.
Use ls -l to list files with extra information.
Use ls -la to list all files (including hidden) with extra information.

FAT32: set long filename and 8.3 filename separately [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I need to construct a SDHC card (FAT32) with a directory where I have chosen the short and long filenames independently. E.g. short filename MYDIR but long name i am a cool name. yeah. check out the awesomeness. Based on Wikipedia, there is no mandatory correlation between the two names, so my goal should be possible:
there is no compulsory algorithm for creating the 8.3 name from an LFN
-- http://en.wikipedia.org/wiki/8.3_filename#Overview
I can use any necessary system to do this (windows, mac, linux, hex editor) but the easier the better. Thanks!
The short file name is automatically and compulsorily constructed from the LFN using the algorithm you mentioned. (Also detailed in the FAT32 specifications). This is done by the file-system driver (at least on Windows and Linux).You really can't change that, unless you modify the driver which is not advisable. If you want to do this only for one directory, then you could achieve this by modifying the disk image in a hex editor being wary of not creating duplicate entries with the same name.
Here is what I tried on Linux:
#dd if=/dev/zero of=fatImage bs=1048576 count=256
#mkfs.vfat -F 32 fatImage
#mount -o loop fatImage /mnt
#cd /mnt
#mkdir ThisIsALongDirectoryName
The fat driver generates a short name for the directory:THISIS~1.
You can use both names to access it.
#cd /mnt/ThisIsALongDirectoryName
#cd /mnt/THISIS~1
Then after unmounting the partition, I opened the image in a hex editor(Okteta on KDE), searched for the SFN entry THISIS~1,
and replaced it with MYNEWDIR. Also,each 32 byte LFN sub-entry stores a checksum of the SFN at offset 13.
So I had to calculate and replace the checksum of THISIS~1(which is 0xA6)
with the checksum for MYNEWDIR(which is 0x6A) in all the LFN sub-entries.After saving the modifications,I remounted the image and was able to access the directory using the old LFN and the new SFN.
#cd /mnt/ThisIsALongDirectoryName
#cd /mnt/MYNEWDIR
I wouldn't rely in Wikipedia as a technical reference. It's better to consult Microsoft's documentation. Reading up on this, I think there may be a relationship between the two files, so I would not recommend fiddling with these. You are probably better off using a short name.

Resources